Very nice idea. Kind of a StreetFighter style.
I'm pretty firm with oUF if you got questions just PM me.
-----------------------------------
I got suggestion on how to do the positioning stuff more easily:
-----------------------------------
1) First you create your center piece.
Code:
local centerPiece = CreateFrame(nil, "MyCenterPiece", UIParent)
centerPiece:SetSize(256,128)
centerPiece:SetScale(1)
centerPiece:SetPoint("TOP")
centerPiece.texture = CenterPiece:CreateTexture(nil, "BACKGROUND", nil, -8)
centerPiece.texture:SetAllPoints()
centerPiece.texture:SetTexture("Interface\\Addons\\!beatemupmedia\\centerpiece")
2) Now we create the player and target styles. The trick with positioning is to use already existing edges. You do not have to set width. You just need points. Thus your point for your player frame should go from the topleft corner of UIParent to the topleft edge of centerPiece.
I suggest that you keep positions of self.Health and self.Power relative to the parent frame, thus self is the container that you will position absolutely.
Code:
--create health func
local function CreateHealth(self)
--self.Health
self.Health = CreateFrame("StatusBar",nil,self)
self.Health:SetPoint("TOPLEFT") --TOPLEFT of parent = self
self.Health:SetPoint("TOPRIGHT") --TOPRIGHT of parent = self
self.Health:SetHeight(self.height*0.8) 80% of the height of self
end
--create power func
local function CreatePower(self)
--self.Power
self.Power = CreateFrame("StatusBar",nil,self)
self.Power:SetPoint("BOTTOM") --BOTTOM center of parent = self
self.Power:SetHeight(self.height*0.3) 30% of the height of self
self.Power:SetWidth(self.width*0.5) 50% of the width of self
end
--the player style
local function CreatePlayerStyle(self)
self:SetScale(1)
--position self
self:SetPoint("TOPLEFT") --topleft of UIParent
self:SetPoint("TOPRIGHT",centerPiece,"TOPLEFT",0,0) --topright corner of self will point to topleft corner of centerpiece, you still can adjust using the x-coordinate
--we need height, so we add it
self:SetHeight(100)
self.width, self.height = self:GetSize()
CreateHealth(self)
CreatePower(self)
end
--the target style
local function CreateTargetStyle(self)
self:SetScale(1)
--position self
self:SetPoint("TOPLEFT",centerPiece,"TOPRIGHT",0,0) --topleft corner of self will point to topright corner of centerpiece
self:SetPoint("TOPRIGHT") --topright of UIParent
--we need height, so we add it
self:SetHeight(100)
self.width, self.height = self:GetSize()
CreateHealth(self)
CreatePower(self)
end
oUF:RegisterStyle("MyPlayerStyleName", CreatePlayerStyle)
oUF:SetActiveStyle("MyPlayerStyleName")
oUF:Spawn("player","MyPlayerFrameName")
oUF:RegisterStyle("MyTargetStyleName", CreateTargetStyle)
oUF:SetActiveStyle("MyTargetStyleName")
oUF:Spawn("target","MyTargetFrameName")
If your centerpiece texture file does not fill the texture completly you can still use the x-coordinates of the setpoints to adjust the positions of the player and the health frame.
If you work with scale which is not bad at all you may need to multiply your positions with the frame scale. But that needs to be tested live.
For more about setpoints read:
http://wowprogramming.com/docs/widgets/Region/SetPoint