GuiBitmap... positioning bug?
by Jacob · in Torque Game Engine · 01/21/2005 (7:28 pm) · 11 replies
Making my GUIs, I realized that every time I go into the GUI editor, my GuiBitmaps...(so far this has happened to my buttons and regular bitmaps as well) are in a different position and have a different size. Of course I always save my GUIs before exiting :) The interesting thing is that every time I run the editor, my buttons/bitmaps will be in a slightly different position and be a slightly different size - the variance is about +/- 10 pixels. It really makes my GUIs look uneven. Please help :)
About the author
#2
01/21/2005 (8:27 pm)
Yes, I am familiar with that but this is occuring at the same preview resolution.
#3
01/22/2005 (8:50 am)
Let me just explain more clearly: this positioning/size change is not just in the editor, if it was, no big deal but it happens when I exit the editor as well, meaning that every time I add something to my GUI and save/exit, the bitmaps that I DID NOT touch at all are also changed/moved. This means that the user would see it as well. Again, I don't change the preview resolution and yet with each editor session, after I exit the editor, things are different. A change of a few pixels in some cases would not be that noticable but in my case it is.
#4
The problem came from the fact that we were setting the position of our GUI elements based on a 640x480 resolution. The size and position was relative to this size, so when the user changes to 800x600 or 1024x768, all of the buttons would scale accordingly.
What was happening was when we made changes to the GUI in something other than 640x480 and saved, the editor would try to recalculate the size and position of everything. "115 340" became "114 338" and so on.
In the end, we decided not to edit GUI elements using the editor at all. The artist created all of the GUI elements in photoshop and then cut out each of the buttons, along with a text file explaining the screen position and size of each file and where it was supposed to go.
After I used the GUI editor to create, name, and roughly place all of the elements, I saved the .gui file and edited the coordinates by hand. This is probably the most accurate way to work. It's the artists job to design the interface, not mine.
01/31/2005 (8:38 am)
We've had this problem as well.The problem came from the fact that we were setting the position of our GUI elements based on a 640x480 resolution. The size and position was relative to this size, so when the user changes to 800x600 or 1024x768, all of the buttons would scale accordingly.
What was happening was when we made changes to the GUI in something other than 640x480 and saved, the editor would try to recalculate the size and position of everything. "115 340" became "114 338" and so on.
In the end, we decided not to edit GUI elements using the editor at all. The artist created all of the GUI elements in photoshop and then cut out each of the buttons, along with a text file explaining the screen position and size of each file and where it was supposed to go.
After I used the GUI editor to create, name, and roughly place all of the elements, I saved the .gui file and edited the coordinates by hand. This is probably the most accurate way to work. It's the artists job to design the interface, not mine.
#5
If you want you GUI elements to all be the same relative size (ie: take up 10% of screen) no matter what resolution the user is in the use relative for both sizings.
01/31/2005 (9:20 am)
The GUI editor is great once you understand how to use it. The trick is the horizSizing and vertSizing. For things that you want to be positioned absolutely and not scale at different resolutions use right/left for the horizSizing and top/bottom for the vertSizing. The naming is a little wierd b/c things that are on the left side of the screen should use the right horizSizing and at the bottom use top for vertSizing, and vice versa for right side and top of screen.If you want you GUI elements to all be the same relative size (ie: take up 10% of screen) no matter what resolution the user is in the use relative for both sizings.
#6
[suggestion]
If someone wanted to take a good look at how the relative paramaters work, and specifically refactoring the code to make the positioning either totally "loss-less", or at least consistent across the entire gui set, I bet it would be a very much revered resource!
[/suggestion]
01/31/2005 (10:51 am)
One issue to keep in mind with relative positioning is that the recalculations use float math, but then are truncated down to ints for final positioning. This can cause button "drift" when a lot of screen resolution changes are made, which can be disconcerting.[suggestion]
If someone wanted to take a good look at how the relative paramaters work, and specifically refactoring the code to make the positioning either totally "loss-less", or at least consistent across the entire gui set, I bet it would be a very much revered resource!
[/suggestion]
#7
01/31/2005 (12:44 pm)
That's one of my todo tasks for the editor work we're doing here at GG; the new inspector suffers from the problem.
#8
I am glad to know that it's on the list Ben!
01/31/2005 (7:07 pm)
What I have figured out is, that as long as I don't go into the editor, I can change resolutions as many times as I want and everything will stay exactly as I want it (most of my sizing is set to relative). Since nothing is saved to the .gui file while changing resolution, that makes complete sense. Actually, even going in and out of the editor only changes/moves my buttons etc. for the duration of the session...as soon as I restart, it's back to normal. It only has an effect when I move or add something, therefore having to save my gui that things get funny on the next run.I am glad to know that it's on the list Ben!
#9
Each time i opened the gui file, images were shrinking and moving, i thought i was loosing my mind or my calculator had lost its mind.
First a pixel at a time, then 2 then 3.
So ya, im doing it by hand, its faster that way anyway.
lates,
Chad
06/25/2006 (1:06 am)
Figured i would confirm what you guys are seeing.Each time i opened the gui file, images were shrinking and moving, i thought i was loosing my mind or my calculator had lost its mind.
First a pixel at a time, then 2 then 3.
So ya, im doing it by hand, its faster that way anyway.
lates,
Chad
#10
06/25/2006 (1:32 am)
Im not sure if this is related.. but Im having an issue when creating gui elements from script after the playGui has been loaded. A gui position of "100 100" in the playGui.cs will not match up if I create a new Gui element from script with "100 100". This doesnt happen in lower resolutions. I have tried every combination of sizing.
#11
It's a known rounding issue when switching resolutions inside the GUI editor, or when you switch the editor on/off. I always create my GUI's via code.
06/25/2006 (3:41 am)
@Chad, It's a known rounding issue when switching resolutions inside the GUI editor, or when you switch the editor on/off. I always create my GUI's via code.
Torque 3D Owner Robert Blanchet Jr.
I believe this is what your experiencing.