Thread: Need oUF help

  1. #1

    Need oUF help

    Hey, I'm trying to get a 1 pixel border around my cast bar's icon in oUF. I'm really not sure how to go about doing it. I have some code here, not expertly written or anything, and I was hoping someone could go over it and tell me what I could add to get a border around the icon.

    Code:
    local Castbar = CreateFrame("StatusBar", nil, self)
    	Castbar:SetStatusBarTexture(TEXTURE)
    	Castbar:SetStatusBarColor(1/6, 1/6, 2/7)
    	Castbar:SetSize(230, 12)
    	Castbar:SetPoint('TOP', self, 0, 16)
    	Castbar:SetPoint('LEFT', self, 0, 16)
    	Castbar:SetPoint('RIGHT', self, 0, 16)
    			
    	Castbar:SetBackdrop(BACKDROP)
    	Castbar:SetBackdropColor(0, 0, 0)
    
    local Icon = Castbar:CreateTexture(nil, "OVERLAY")
    	Icon:SetSize(20, 20)
    	Icon:SetPoint("TOPRIGHT", self, "TOPRIGHT", 25, 0)
    
    local Time = Castbar:CreateFontString(nil, "OVERLAY")
    	Time:SetPoint("RIGHT", Castbar)
    	Time:SetFont(FONT, 8, 'OUTLINEMONOCHROME')
    
    local Text = Castbar:CreateFontString(nil, "OVERLAY")
    	Text:SetPoint("LEFT", Castbar, 2, 0)
    	Text:SetFont(FONT, 8, 'OUTLINEMONOCHROME')
    
    self.Castbar = Castbar
    self.Castbar.bg = Background
    self.Castbar.Icon = Icon
    self.Castbar.Time = Time
    self.Castbar.Text = Text

  2. #2
    Deleted
    Code:
    Icon.texture = Icon:CreateTexture()
    Icon.texture:SetPoint("TOPLEFT", -1, 1)
    Icon.texture:SetPoint("BOTTOMRIGHT", 1, -1)
    Icon.texture:SetTexture(0,0,0)

  3. #3
    I tried what you wrote Treeston and it didn't work for me (frames didn't load). I do admit though I'm entirely new to LUA and what I've achieved thus far has been a mix of luck and reading. Its quite possible I did something wrong or placed it wrong.

    Code:
    local Castbar = CreateFrame("StatusBar", nil, self)
    	Castbar:SetStatusBarTexture(TEXTURE)
    	Castbar:SetStatusBarColor(1/6, 1/6, 2/7)
    	Castbar:SetSize(230, 12)
    	Castbar:SetPoint('TOP', self, 0, 16)
    	Castbar:SetPoint('LEFT', self, 0, 16)
    	Castbar:SetPoint('RIGHT', self, 0, 16)
    			
    	Castbar:SetBackdrop(BACKDROP)
    	Castbar:SetBackdropColor(0, 0, 0)
    
    local Icon = Castbar:CreateTexture(nil, "OVERLAY")
    	Icon:SetSize(20, 20)
    	Icon:SetPoint("TOPRIGHT", self, "TOPRIGHT", 25, 0)
    
    	Icon.texture = Icon:CreateTexture("OVERLAY")
    	Icon.texture:SetPoint("TOPLEFT", -1, 1)
    	Icon.texture:SetPoint("BOTTOMRIGHT", 1, -1)
    	Icon.texture:SetTexture(TEXTURE)
    
    local Time = Castbar:CreateFontString(nil, "OVERLAY")
    	Time:SetPoint("RIGHT", Castbar)
    	Time:SetFont(FONT, 8, 'OUTLINEMONOCHROME')
    
    local Text = Castbar:CreateFontString(nil, "OVERLAY")
    	Text:SetPoint("LEFT", Castbar, 2, 0)
    	Text:SetFont(FONT, 8, 'OUTLINEMONOCHROME')
    
    self.Castbar = Castbar
    self.Castbar.bg = Background
    self.Castbar.Icon = Icon
    self.Castbar.Time = Time
    self.Castbar.Text = Text
    That is how I have it placed right now, I just copy pasted first, and it doesn't work like that. Like I said though its more then likely just me. If you wouldn't mind guiding my hand a bit.

    Edit:

    I got it working with a backdrop. Courtesy of Freebaser on wow-interface.

    Code:
    local Icon = Castbar:CreateTexture(nil, "OVERLAY")
    	Icon:SetSize(20, 20)
    	Icon:SetPoint("TOPRIGHT", self, "TOPRIGHT", 25, 0)
    	Icon:SetTexCoord(.1, .9, .1, .9)
    
    local IconBackdrop = CreateFrame("Frame", nil, Castbar)
            IconBackdrop:SetAllPoints(Icon)
            IconBackdrop:SetFrameStrata("LOW")
            IconBackdrop:SetBackdrop(BACKDROP)
            IconBackdrop:SetBackdropColor(0, 0, 0)
            IconBackdrop:SetBackdropBorderColor(0, 0, 0)
    Last edited by Soun; 2010-11-03 at 08:42 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •