Thread Tools Display Modes
11/12/14, 08:13 AM   #1
justinbarrett
Join Date: Nov 2014
Posts: 25
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.
  Reply With Quote
11/12/14, 09:32 AM   #2
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
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).
  Reply With Quote
11/12/14, 11:39 AM   #3
justinbarrett
Join Date: Nov 2014
Posts: 25
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.

Last edited by justinbarrett : 11/12/14 at 11:53 AM.
  Reply With Quote
11/12/14, 01:19 PM   #4
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by justinbarrett View Post
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_)

Originally Posted by justinbarrett View Post
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.
  Reply With Quote
11/12/14, 02:41 PM   #5
justinbarrett
Join Date: Nov 2014
Posts: 25
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
  Reply With Quote
11/12/14, 03:38 PM   #6
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
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.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » GuiRoot:GetWidth() question


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