WoWInterface - View Single Post - Pixel Perfect UIScale
View Single Post
02-27-20, 11:40 PM   #2
A Pyroguard Emberseer
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,975
I don't bother with pixel-perfect layouts, but there are a couple options.

First, there's the PixelUtil API provided by Blizzard.

Alternatively, you can calculate the optimal UI scale with a mathematical formula.
768 / select(2, GetPhysicalScreenSize())
768 is the normalized height of the drawing area before scaling takes place. The width is dynamic, as in it changes based on aspect ratio. GetPhysicalScreenSize() returns the pixel measurements of the drawing area. Keep in mind, if you're not setting the UI Scale to this, you need to adjust with the effective scale of your frame's parent.
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote