Originally Posted by
lawomous
Looks pretty.
Pretty sure that's only a shop showing how he wants it to look.
Anyways, it's not pretty, but GUIs were never my strong side. Especially not when I don't spend ages on them.
Code:
local buttonSize = 40
local buttonOffset = 5
local buttons = {"1","2","3","4","5","6","7","8","9"}
local modifiers = {"","SHIFT-","CTRL-","ALT-"}
local frame = CreateFrame("Frame")
frame:SetSize(#buttons*(buttonSize+buttonOffset)+buttonOffset,#modifiers*(buttonSize+buttonOffset)+buttonOffset)
frame:SetPoint("CENTER")
local frames = {}
local function btnUpdate(s)
local binding = GetBindingByKey(s.button)
if binding then
local btn = binding:match("CLICK (.+):LeftButton")
local f = _G[btn]
if f then
local spell = GetActionTexture(f:GetAttribute("action"))
s:SetNormalTexture(spell)
return
end
end
s:SetNormalTexture(nil)
end
for btnNum, button in ipairs(buttons) do
for modNum, mod in ipairs(modifiers) do
local btn = CreateFrame("Button", nil, frame)
btn:SetPoint("TOPLEFT",btnNum*(buttonSize+buttonOffset)-buttonSize, (modNum*(buttonSize+buttonOffset)-buttonSize)*(-1))
btn:SetSize(buttonSize,buttonSize)
btn.text = btn:CreateFontString()
btn.text:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
btn.text:SetPoint("BOTTOM")
btn.text:SetText(mod..button)
btn.update = btnUpdate
btn.button = mod..button
frames[btn.button] = btn
end
end
frame:SetScript("OnEvent",function()
for _,f in pairs(frames) do f:update() end
end)
frame:RegisterEvent("UPDATE_BINDINGS")
SlashCmdList["CAS"]=function() frame[frame:IsShown() and "Hide" or "Show"](frame) end
SLASH_CAS = "/cas"
Completely and utterly drycoded. Hope I didn't mess up anywhere.