View Single Post
01-20-12, 05:55 PM   #1537
Epiphany17
A Flamescale Wyrmkin
 
Epiphany17's Avatar
AddOn Compiler - Click to view compilations
Join Date: Oct 2009
Posts: 104
Thanks Wimpface

And TheGeek, I like your UI, it just doesn't seem to fit my personal taste ^-^;

Originally Posted by Clynikal View Post
I would love to know how you achieved those DBM timers, Epi.
I have been tinkering with my !DBM template and my only issue thus far is getting a border of some sort around the timers.
I liberated the !dbm file from FreeUI.

I replaced this, which is at the top of the file.

Code:
local F, C, L = unpack(FreeUI)
With this, which is in another file inside FreeUI.

Code:
local addon, core = ...

core[1] = {} -- F, functions
core[2] = {} -- C, constants/config
core[3] = {} -- L, localization

FreeUI = core

local F, C, L = unpack(select(2, ...))

C.media = {
	["backdrop"] = "Interface\\ChatFrame\\ChatFrameBackground", -- default backdrop
	["font"] = "Fonts\\font.ttf", -- default pixel font
	["texture"] = "Interface\\AddOns\\SharedMedia\\statusbar\\pHishTex11.tga", -- statusbar texture
}

-- [[ Functions ]]

local function dummy() end

local function CreateBD(f, a)
	f:SetBackdrop({
		bgFile = C.media.backdrop, 
		edgeFile = C.media.backdrop, 
		edgeSize = 1, 
	})
	f:SetBackdropColor(0, 0, 0, a or .5)
	f:SetBackdropBorderColor(0, 0, 0)
end

local function CreateBG(frame)
	local f = frame
	if frame:GetObjectType() == "Texture" then f = frame:GetParent() end

	local bg = f:CreateTexture(nil, "BACKGROUND")
	bg:SetPoint("TOPLEFT", frame, -1, 1)
	bg:SetPoint("BOTTOMRIGHT", frame, 1, -1)
	bg:SetTexture(C.media.backdrop)
	bg:SetVertexColor(0, 0, 0)

	return bg
end

local function CreateSD(parent, size, r, g, b, alpha, offset)
	local sd = CreateFrame("Frame", nil, parent)
	sd.size = size or 5
	sd.offset = offset or 0
	sd:SetBackdrop({
		edgeFile = C.media.glow,
		edgeSize = sd.size,
	})
	sd:SetPoint("TOPLEFT", parent, -sd.size - 1 - sd.offset, sd.size + 1 + sd.offset)
	sd:SetPoint("BOTTOMRIGHT", parent, sd.size + 1 + sd.offset, -sd.size - 1 - sd.offset)
	sd:SetBackdropBorderColor(r or 0, g or 0, b or 0)
	sd:SetAlpha(alpha or 1)
end

local function CreateFS(parent, size, justify)
    local f = parent:CreateFontString(nil, "OVERLAY")
    f:SetFont(C.media.font, size, "OUTLINEMONOCHROME")
    f:SetShadowColor(0, 0, 0, 0)
    if(justify) then f:SetJustifyH(justify) end
    return f
end

local function CreatePulse(frame, speed, mult, alpha) -- pulse function originally by nightcracker
	frame.speed = speed or .05
	frame.mult = mult or 1
	frame.alpha = alpha or 1
	frame.tslu = 0 -- time since last update
	frame:SetScript("OnUpdate", function(self, elapsed)
		self.tslu = self.tslu + elapsed
		if self.tslu > self.speed then
			self.tslu = 0
			self:SetAlpha(self.alpha)
		end
		self.alpha = self.alpha - elapsed*self.mult
		if self.alpha < 0 and self.mult > 0 then
			self.mult = self.mult*-1
			self.alpha = 0
		elseif self.alpha > 1 and self.mult < 0 then
			self.mult = self.mult*-1
		end
	end)
end

F.dummy = dummy
F.CreateBD = CreateBD
F.CreateBG = CreateBG
F.CreateSD = CreateSD
F.CreateFS = CreateFS
F.CreatePulse = CreatePulse
I'm not sure I needed to add all of that, but it worked.

Of course this, you would keep the backdrop the same, and change the texture and font to whatever you'd like.
Code:
C.media = {
	["backdrop"] = "Interface\\ChatFrame\\ChatFrameBackground", -- default backdrop
	["font"] = "Fonts\\font.ttf", -- default pixel font
	["texture"] = "Interface\\AddOns\\SharedMedia\\statusbar\\pHishTex11.tga", -- statusbar texture