Thread Tools Display Modes
12-28-06, 12:03 AM   #1
johnflesh
A Kobold Labourer
Join Date: Dec 2006
Posts: 1
Custom IMG Graphics UI

Lately I have been trying to track down a nice mod to put a custom graphic on the BACKGROUD below my UI for looks. I have used XArt and I found a new one called Darktide (which was just recently remade from an old one borrowing XArt's code). The problem is they are seemingly both set to resolutions above my own.

I am not in search of the mod so much as a code for this in .lua.

I will give one example of an LUA I have been trying to alter (Darktide) and then tell you the results based on my monitor's resolution and how it interacts. (I have yet to alter it successfully) so I came here for some help.

Code:
Darktide = {}

function Darktide:GetClass()
    local _, class = UnitClass("player")
    class = string.lower(class)
    return class
end

function Darktide:CreateArtFrame()
    self.frame = CreateFrame("Frame", "DarktideFrame", UIParent)
    self.frame:SetFrameStrata("BACKGROUND")
    self.frame:EnableMouse(false)
    self.frame:SetMovable(false)
    self.frame:SetWidth(1536)
    self.frame:SetHeight(256) -- 6 * 256 = 1536 :)
    self.frame:ClearAllPoints()
    self.frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0)
    
    for i=1,6 do
        self["art"..i] = self.frame:CreateTexture("$parentArt"..i,"BACKGROUND")
        self["art"..i]:SetWidth(256)
        self["art"..i]:SetHeight(256)
        self["art"..i]:SetTexture("Interface\\Addons\\Darktide\\Textures\\"..self:GetClass()..i)
        self["art"..i]:ClearAllPoints()
        if i == 1 then
            self["art"..i]:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", 0, 0)
        else
            self["art"..i]:SetPoint("BOTTOMLEFT", self["art"..i-1], "BOTTOMRIGHT", 0, 0)
        end
        self["art"..i]:Show()
		
    end
	
	self.frame:RegisterEvent("DISPLAY_SIZE_CHANGED")
	self.frame:RegisterEvent("CVAR_UPDATE")
	self.frame:SetScript("OnEvent", function() this:SetScale(UIParent:GetWidth()/1536) end)
	
    self.frame:Show()
end

Darktide:CreateArtFrame()
This code deals with 6 images (.tga) that are 256 x 256.

_____________________________________________________

Again this works fine except my resolution isn't w.1536 - it's width is 1280. So inturn it cuts off some of the graphics that proceed off the stage to the bottom right side.

SO.. I have a few questions here. Each question is similar but is actually quite different and is assuming another route in this success.

1. How can I get this code to work for my own resolution (native) of 1280 x 1024 and have the graphics fit?

2. If I alter (resize) the graphics to meet my native (1280) and then alter the code accordingly, nothing happens. No graphics show up at all.

3. (most important) Is there a way to make a SINGLE graphic work instead of using 6 different pieces? Or in XArt's case, 4 different pieces? If there is a way to get a single graphic to work, what is that code, I am a noob to this but really want to find the solution as it will get me what I want, and teach me all the same.

Thanks for your time and help, in advance.
JohnB.

2.
  Reply With Quote
12-29-06, 01:32 PM   #2
Sajomatic
Deuce Interfaces
 
Sajomatic's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 66
Hey.
First of all I'd like to say , I am not a code monkey... at all.
But I do textures well =)

I would stick with the Xart 'format', I havent heard of Darktide, but I do know Xart is working perfectly. The code for xart seems to put the panels in the right spots, and i think what you are reffering to [self.frame:SetWidth(1536)] is the max resolution available ??

Also there is eepanels, which is another aced mod for textures.

The max size for textures is 512x512, with most panels being 512x256. Remeber that image sizes need to be from the power of 2 so... 2,4,8,16,32,64,128,256,512. And they require a valid alpha channel, as well as being .tga format.


Hope this help a bit...
  Reply With Quote

WoWInterface » Developer Discussions » Graphics Help » Custom IMG Graphics UI

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off