|
12-23-13, 01:07 PM | #1 |
Trying my hand at ouf
So in this thread Phanx reinspired me to try my hand at making an ouf layout.
So far though I'm trying just to make a player health bar and all I get is just the backround and no status bar. According to the documentation I found in ouf itself the healthbar should default to the standard health bar is you don't imply a texture or color to it. So i'm confused. code: Code:
local frame = CreateFrame("Frame", "Bob", UIParent) frame:SetPoint("CENTER",UIParent,0,0) local function Spawn(frame, unit, isSingle) frame:SetPoint("CENTER", UIParent) frame:SetSize(100, 25) local bg = frame:CreateTexture(nil, "BACKGROUND") bg:SetAllPoints(true) bg:SetTexture(0, 0, 0, 0.5) frame.bg = bg end oUF:RegisterStyle("Bob", Spawn) oUF:Spawn("player") -- Position and size local Health = CreateFrame("StatusBar", nil, frame) Health:SetHeight(20) Health:SetPoint('TOP') Health:SetPoint('LEFT') Health:SetPoint('RIGHT') -- Options Health.frequentUpdates = true Health.colorTapping = true Health.colorDisconnected = true Health.colorClass = true Health.colorReaction = true Health.colorHealth = true -- Register it with oUF frame.Health = Health frame.Health.bg = Background |
|
12-23-13, 01:15 PM | #2 |
Congrats and welcome to the oUF'ers
First you declare your health stuff, then you spawn the frames. https://gist.github.com/8102856 is a boilerplate I made You add the healthstatusbar to the shared part |
|
12-23-13, 01:40 PM | #3 |
So then I'm doing it backwards, ok well if I rip your code then put my stuff in there I still don't get anything. Probably missing something though now that I think about it....
Code:
------------------------------------------------------------------------ -- oUF Layout boiletplate -- Author : Kelly Crabbé ------------------------------------------------------------------------ ------------------------------------------------------------------------ -- Namespace ------------------------------------------------------------------------ local _, ns = ... ------------------------------------------------------------------------ -- Config ------------------------------------------------------------------------ local NORMALFONT = STANDARD_TEXT_FONT local TEXTURE = [=[Interface\ChatFrame\ChatFrameBackground]=] local BACKDROP = { bgFile = TEXTURE, insets = {top = -1, bottom = -1, left = -1, right = -1} } ----------------------------- -- Add custom functions (overrides) ------------------------------------------------------------------------ -- UnitSpecific settings ------------------------------------------------------------------------ local UnitSpecific = { player = function(self) -- player specific stuff local frame = CreateFrame("Frame", "Bob", UIParent) frame:SetPoint("CENTER",UIParent,0,0) frame:SetSize(100,100) end, target = function(self) -- target specific stuff end, party = function(self) -- party frames end, boss = function(self) -- boss frames end, arena = function(self) -- arena frames end } UnitSpecific.raid = UnitSpecific.party -- raid is equal to party ------------------------------------------------------------------------ -- Shared settings ------------------------------------------------------------------------ local function Shared(self, unit) self:SetScript("OnEnter", UnitFrame_OnEnter) self:SetScript("OnLeave", UnitFrame_OnLeave) self:RegisterForClicks"AnyUp" -- shared functions local frame = CreateFrame("Frame", "Bob", UIParent) frame:SetPoint("CENTER",UIParent,0,0) -- Position and size local Health = CreateFrame("StatusBar", nil, frame) Health:SetHeight(50) Health:SetPoint('TOP') Health:SetPoint('LEFT') Health:SetPoint('RIGHT') -- Options Health.frequentUpdates = true Health.colorTapping = true Health.colorDisconnected = true Health.colorClass = true Health.colorReaction = true Health.colorHealth = true -- Register it with oUF frame.Health = Health frame.Health.bg = Background -- leave this in!! if(UnitSpecific[unit]) then return UnitSpecific[unit](self) end end oUF:RegisterStyle('Bob', Shared) oUF:Factory(function(self) self:SetActiveStyle('Bob') self:Spawn('player'):SetPoint('CENTER', -300, -250) self:Spawn('target'):SetPoint('CENTER', 300, -250) self:SpawnHeader(nil, nil, 'custom [group:party] show; [@raid3,exists] show; [@raid26,exists] hide; hide', 'showParty', true, 'showRaid', true, 'showPlayer', true, 'yOffset', -6, 'oUF-initialConfigFunction', [[ self:SetHeight(16) self:SetWidth(126) ]] ):SetPoint('TOP', Minimap, 'BOTTOM', 0, -10) end) local PreperationHandler = CreateFrame('Frame') PreperationHandler:RegisterEvent('PLAYER_LOGIN') PreperationHandler:SetScript('OnEvent', function(self, event) -- Insert base function here end) |
|
12-23-13, 05:10 PM | #4 |
Lua Code:
Lua Code:
The Self.Health is a reference to self.Health from oUF itself, in that part you're telling oUF that the frame you called Health is self.Health from oUF. Otherwise oUF doesn't know what to do with it. And this should purely work... Lua Code:
|
|
12-23-13, 09:06 PM | #5 | |
Unfortunately though, still don't get anything that looks like a unitframe. Not certain as to whats going on as I think it should work, but nothing. code |
||
12-23-13, 09:13 PM | #6 |
I see no sign of BugSack in your UI. You should fix that ASAP. Most of the errors you will encounter while developing addons are going to occur during the loading process, which just so happens to be exactly the time when the default UI's error handler can't catch them.
Also, you never give the unit frames a size, so of course you can't see them.
__________________
Retired author of too many addons. Message me if you're interested in taking over one of my addons. Don’t message me about addon bugs or programming questions. Last edited by Phanx : 12-23-13 at 09:15 PM. |
|
WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Trying my hand at ouf |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|