View Single Post
Unread 04-11-10, 11:38 AM   #7
nightcracker
A Molten Giant
 
nightcracker's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 714
UI Scale is one way, but when I'm making an addon, I can't set the users UI scale to my value. So I have to make a workaround. If I scale any value with the following function, there comes out the value needed to represent the amount of "virtual pixels" needed by the frame to get the amount of "real pixels".

Code:
local mult = SetCVar("uiScale", 768/string.match(({GetScreenResolutions()})[GetCurrentResolution()], "%d+x(%d+)"))/GetCVar("uiScale")
local function scale(x) return mult*x end

someframe:SetHeight(scale(10))
someframe:SetWidth(scale(10))
I implemented this method in TukUI and ncUI to get them both pixelperfect.
__________________
Three things are certain,
Death, taxes and site not found,
You, victim of one.
nightcracker is offline   Reply With Quote