ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   GuiRoot:GetWidth() question (https://www.esoui.com/forums/showthread.php?t=2429)

justinbarrett 11/12/14 08:13 AM

GuiRoot:GetWidth() question
 
GuiRoot:GetWidth() is returning a completely different value when I am in windowed mode versus full screen. It is actually returning a value my monitor does not even support(too large). I was wondering if anyone had any similar issue and a work around...or if there are completely different functions for a windowed setup.

merlight 11/12/14 09:32 AM

UI units are not necessarily equal to pixels. If GetUIGlobalScale() returns something other than 1, they're different. You can change the scale in settings (I think, if not, see CustomUIScale in UserSettings.txt).

justinbarrett 11/12/14 11:39 AM

sorry should have posted sooner....I was not setting(min, max) when changing...now I have an ugly workaround...do you, or anyone else, know an event that can tell if I am switching windowed/full screen?

on a side note the ui stuff should be 1-1 pixel ratio...unless they are prjected on a different layer in 3d space...but I am also very very new to this api....I just wrapped up the basics for my plugin that took me like 3-4 days in my off work off family and kids time...so all in all about 4 hours...for a simple xp bar...anyone here could have probably don it it about 10 minutes :) lol...but hey that's still progress.

merlight 11/12/14 01:19 PM

Quote:

Originally Posted by justinbarrett (Post 13191)
sorry should have posted sooner....I was not setting(min, max) when changing...now I have an ugly workaround...do you, or anyone else, know an event that can tell if I am switching windowed/full screen?

Not sure, I only found EVENT_SCREEN_RESIZED (*integer* _x_, *integer* _y_)

Quote:

Originally Posted by justinbarrett (Post 13191)
on a side note the ui stuff should be 1-1 pixel ratio...

They are not. There's even a slider under Settings->Video->Interface where you can change it. The game doesn't map UI units to pixels exactly as you might think, not even when the scale is 1:1. Some controls are aligned to pixel boundaries, so you may have two thin lines 1 unit thick, and they will look different in different places (sometimes one disappears, or partly covers a line 2 pixels thick). Generally you don't need to care about that, unless you really need pixel precision.

justinbarrett 11/12/14 02:41 PM

they are, unless they are being altered in another way, like drawing a view to a specific camera and layer, then changing the aspect ratio. or if they are sub/super sampled....but they do not appear to be. I will have to take your word for it though :)

merlight 11/12/14 03:38 PM

Perhaps we're talking about different things. If you have 2 textures for example:
Lua Code:
  1. tex1:SetDimensions(100, 100)
  2. tex2:SetAnchor(TOPLEFT, tex1, TOPLEFT, 1, 1)
  3. tex2:SetAnchor(BOTTOMRIGHT, tex1, BOTTOMRIGHT, -1, -1)

1) doesn't mean tex1 is 100x100px; it can be 67x67px, if GetUIGlobalScale() == 0.67
2) doesn't mean there's 1 px border between tex1 and tex2. Could be 1px, 0px or 2px, depending on the scale and alignment.


All times are GMT -6. The time now is 02:22 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI