02-28-20, 02:24 PM | #4 |
Code:
local screenHeight = GetScreenHeight() local physicalWidth, physicalHeight = GetPhysicalScreenSize() local pixelPerfectScale = 768 / physicalHeight if screenHeight >= 1200 then UIParent:SetScale(pixelPerfectScale) else SetCVar("useUiScale", 1) SetCVar("UIScale", pixelPerfectScale) end Code:
/script SetCVar("uiScale", 768/string.match(({GetScreenResolutions()})[GetCurrentResolution()], "%d+x(%d+)")) Code:
function E:UIScale(init) local scale = E.global.general.UIScale -- `init` will be the `event` if its triggered after combat if init == true then -- E.OnInitialize --Set variables for pixel scaling local pixel, ratio = 1, 768 / E.screenheight E.mult = (pixel / scale) - ((pixel - ratio) / scale) E.Spacing = (E.PixelMode and 0) or E.mult E.Border = ((not E.twoPixelsPlease) and E.PixelMode and E.mult) or E.mult*2 elseif InCombatLockdown() then E:RegisterEventForObject('PLAYER_REGEN_ENABLED', E.UIScale, E.UIScale) else -- E.Initialize UIParent:SetScale(scale) --Check if we are using `E.eyefinity` local width, height = E.screenwidth, E.screenheight E.eyefinity = E:IsEyefinity(width, height) --Resize E.UIParent if Eyefinity is on. local testingEyefinity = false if testingEyefinity then --Eyefinity Test: Resize the E.UIParent to be smaller than it should be, all objects inside should relocate. --Dragging moveable frames outside the box and reloading the UI ensures that they are saving position correctly. local uiWidth, uiHeight = UIParent:GetSize() width, height = uiWidth-250, uiHeight-250 elseif E.eyefinity then --Find a new width value of E.UIParent for screen #1. local uiHeight = UIParent:GetHeight() width, height = E.eyefinity / (height / uiHeight), uiHeight else width, height = UIParent:GetSize() end E.UIParent:SetSize(width, height) E.UIParent.origHeight = E.UIParent:GetHeight() --Calculate potential coordinate differences E.diffGetLeft = E:Round(abs(UIParent:GetLeft() - E.UIParent:GetLeft())) E.diffGetRight = E:Round(abs(UIParent:GetRight() - E.UIParent:GetRight())) E.diffGetBottom = E:Round(abs(UIParent:GetBottom() - E.UIParent:GetBottom())) E.diffGetTop = E:Round(abs(UIParent:GetTop() - E.UIParent:GetTop())) if E:IsEventRegisteredForObject('PLAYER_REGEN_ENABLED', E.UIScale) then E:UnregisterEventForObject('PLAYER_REGEN_ENABLED', E.UIScale, E.UIScale) end end end function E:PixelBestSize() local scale = E:Round(768 / E.screenheight, 5) return max(0.4, min(1.15, scale)) end function E:PixelScaleChanged(event) if event == 'UI_SCALE_CHANGED' then E.screenwidth, E.screenheight = GetPhysicalScreenSize() E.resolution = format('%dx%d', E.screenwidth, E.screenheight) end E:UIScale(true) --Repopulate variables E:UIScale() --Setup the scale E:Config_UpdateSize(true) --Reposition config end function E:Scale(x) local mult = E.mult return mult * floor(x / mult + 0.5) end
__________________
-- Be3f. |
|
WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Pixel Perfect UIScale |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Switch to Hybrid Mode |
Threaded Mode |
|
|