WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   Creating border for combo points (https://www.wowinterface.com/forums/showthread.php?t=27258)

Empower 09-12-09 06:00 AM

Creating border for combo points
 
I've been wanting to change the looks of the current oUF layout's combo points that I'm using (Tukz's if it matters).
So I've created the texture I want, and got it into the game fine however Tukz's old combo points never had a border attached to them so I'm struggling to find a way to add one. He has a presaved border texture which I'd like to use but can't find a way to apply it to the combo point bar texture.

Script related to Cpoints that I can find is:

self.CPoints = {}
self.CPoints.unit = PlayerFrame.unit
for i = 1, 5 do
self.CPoints[i] = self.Health:CreateTexture(nil, "OVERLAY")
self.CPoints[i]:SetHeight(18)
self.CPoints[i]:SetWidth(48)
self.CPoints[i]:SetTexture(bubbleTex)
if i == 1 then
self.CPoints[i]:SetPoint("TOPLEFT", -80, 100)
self.CPoints[i]:SetVertexColor(0.65, 0.63, 0.35)
else
self.CPoints[i]:SetPoint("TOP", self.CPoints[i-1], "BOTTOM", 1)
end
end
self.CPoints[2]:SetVertexColor(0.65, 0.63, 0.35)
self.CPoints[3]:SetVertexColor(0.65, 0.63, 0.35)
self.CPoints[4]:SetVertexColor(0.74, 0.25, 0.25)
self.CPoints[5]:SetVertexColor(0.45, 0.72, 0.45)
self:RegisterEvent("UNIT_COMBO_POINTS", UpdateCPoints)
end

Am I in the right area?
Any help would be greatly appreciated. If this thread is in the wrong place if someone could point me in the right direction and I'll delete this.
Note - I saved my texture as bubbleTex so it didn't cause any adverse effects anywhere else.

nailertn 09-12-09 07:42 AM

If the texture file you use has the border sections aligned and clustered correctly, it is actually pretty easy, something like the below code should do it.

Code:

local backdrop = {
        bgFile = "Interface\\Buttons\\WHITE8X8",
        -- use the correct path below, mind the double \\
        edgeFile = "Interface\\AddOns\\MyMediaFolder\\MyBorderFile",
        edgeSize = 8,
        insets = { left = 2, right = 2, top = 2, bottom = 2 }
}

self.CPoints = {}
self.CPoints.unit = PlayerFrame.unit
for i = 1, 5 do
        self.CPoints[i] = CreateFrame("Frame", nil, self.Health)
        self.CPoints[i]:SetHeight(18)
        self.CPoints[i]:SetWidth(48)
        -- the below line may be skipped, use only if cpoints are not visible
        self.CPoints[i]:SetFrameLevel(self.Health:GetFrameLevel() + 1)
        self.CPoints[i]:SetBackdrop(backdrop)
        if i == 1 then
                self.CPoints[i]:SetPoint("TOPLEFT", -80, 100)
                self.CPoints[i]:SetBackdropColor(0.65, 0.63, 0.35)
        else
                self.CPoints[i]:SetPoint("TOP", self.CPoints[i-1], "BOTTOM", 1)
        end
end

self.CPoints[2]:SetBackdropColor(0.65, 0.63, 0.35)
self.CPoints[3]:SetBackdropColor(0.65, 0.63, 0.35)
self.CPoints[4]:SetBackdropColor(0.74, 0.25, 0.25)
self.CPoints[5]:SetBackdropColor(0.45, 0.72, 0.45)
self:RegisterEvent("UNIT_COMBO_POINTS", UpdateCPoints)
end

Play around with the edgeSize and inset sizes to find a nice fit. However if your border file is neither segmented nor a uniform texture you can apply without rotation and clipping it is a pain in the ass you don't want to experience.

(That last 'end' closes a function preceding the code snippet you pasted.)

Empower 09-13-09 03:03 AM

Worked a treat, thanks :cool:


All times are GMT -6. The time now is 08:08 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI