Game Development Community

In and out of gui editor moves controls around

by Clint S. Brewer · in Torque Game Engine · 03/06/2005 (10:33 am) · 9 replies

Since there was no official reply to my question about the bug tracking form...I'll just post bugs here instead of using that form.


small but annoying bug with gui editor

problem:
When switching in and out of the gui editor my controls moved arround on me. The more you switch the more they move.

reproduce it:
- run torque in windowed 800x600 mode
- start up a game
- open gui editor. hit F10 to edit the PlayGui
- switch gui editor into 1024x768 working size mode
- do some work (probably not necessary though)
- hit F10 to toggle out
- hit F10 to go back into gui editor notice any changes?
- toggle in and out a bunch of times.
- you should see your controls sliding arround on the screen.

I'm not trying to reproduce right now...so here are some more details in case you have trouble:
I was modifying the main Player Gui.
I changed the bitmaps that covered the energy and health
I changed their size to be relative and moved everything arround a bit.
I was getting things lined up very nicely and then noticed that things seemed to move around. I mainly noticed that the health meter was peeking out from behind the bitmap hiding it.


and in glorioussss conclusion!
probably some sort of rounding/precision error doing the conversions from 1024x768 to 800x600... when I ran in 1024x768 fullscreen and edited in 1024x768 I did not have this problem.

#1
03/06/2005 (10:51 am)
You got it....it is a "rounding" issue. I was told that the recalculating uses float math but is converted to integers for final positioning. I had the same question and Ben Garney mentioned that fixing this "bug" is on his to do list. For now, the way to avoid this issue, is to edit only in the screen resolution. In fact, I have added 1280x1024 to the GUI Editor res list because that's my preferred res at this time :)
#2
03/06/2005 (11:17 am)
I've found that in the long run, designing all of your GUI's in the lowest targetted resolution you will support for your project will be your best path. That way, if/when a player wants to play at a higher resolution, the conversion errors are only in one direction, and very minor--and therefore don't compound themselves during the back and forth conversions.
#3
03/06/2005 (11:28 am)
Sounds like a good suggestion...do we know if this issue will be addressed in TSE? I suppose that if Ben - or anyone fixes it in TGE, it would be possible to implement it in TSE also.
#4
03/06/2005 (12:20 pm)
I would have to say you are doing something wrong.

First of all, it would obviously be wiser to use 1024x768 resolution and then work on an 800x600 pallet instead of using a 800x600 pallet to work on a 1024x768. However, I did run your crazy configuration while switching resolutions and fullscreen to window and back again. Working in 640x480 while running 1280x1024 and working on 1024x768 resolution and pallet and I cannot get things to "slide" around on me. I admit that controls can be a freaking nightmare when you don't know how to work them properly, but they aren't giving me any trouble at all. Send me your GUI and I'll send it back with some tips on what's going wrong if you like.
#5
03/06/2005 (12:28 pm)
Gonzo, this bug has been confirmed by GG staff before. About a year ago when I created a thread about it.
Say you position a button at 320x320, then you disable the GUI editor to test the button. You find that the position is satisfying, but you want to change it's shape.

So you go back into the GUI editor, and.. what has happened? The element has moved 2x2 pixels.
This is the same on both 800x600 and 1024x768 with stock TGE.
#6
03/06/2005 (12:40 pm)
Thanks for your offer Gonzo,
but there is no problem for me anymore. I just run in the same resolution I design in and it's fine. I tested playing with an interface I designed in 10x7 at 6x4 and it was fine....well almost fine, a couple of the text controls I had set to relative shrunk so small you couldn't read the text...but that's another problem.
#7
03/06/2005 (1:11 pm)
@Gonzo: The issue doesn't actually become humanly visible until you also start using "Relative" in your gui positioning, which is possibly why you haven't noticed it.
#8
03/06/2005 (6:00 pm)
I see what is happening now. You have to be testing for it to notice what the deal is. The problem is quite simple actually. It's that damn number 'Zero' that just throws everything out of whack. the upperleft corner of the screen that is as far as you can go without going negative is "0 0". Now lets say you take an 800x600 Canvas and devide it in half. 400x300 is what you get, right? Not exactly. we see 400x300 but the engine see's 400.5 x 300.5 because the Canvas resolution is in reality 801 x 601. So every time the window changes size you lose a half on the first change and then a half on the change back which totals 1 pixel per screen swap or resolution change.


I managed to confirm this by setting resolution at 800x600 and then using a GuiWindow of 600 x 400(leaves me 100 pixels even on each side), set sizing to relative, move the GuiWindow to position "60 60", and then toggled back and forth, back and forth between the screen and the GuiEditor and I could clearly see a it move to "59 59", "58 58", "57 57", "56 56", etc...

I would seem that the most intuitive solution would be to adjust the engine to set the bounds at a proper setting like 799x599 or 1023x767, 1279x1023, 1599x1199, etc... Or to have the first co-ordinate "1 1" instead of "0 0". Without even looking at it though I would say the adjusted resolution is probably a more viable solution. I guess you could also visit all of the resizing functions and wherever the resolution is devided by 2, you could FIRST have it add back in 1.0 to make up for the miscount of one that you gets you the 0.5's when you devide


if you haven't quite grasped what I'm saying then think of it like this... When you count to 800 the first word out of your mouth is "one", not "zero". If you start at zero and count to 800 you end up with 801 numbers counted total because zero is in fact "one" number. So to get a proper count of 800 you need to either start at 1, or end at 799.
#9
09/26/2008 (10:30 pm)
Sor for reviving an old thread but was this problem ever fixed ???? i would like to have this functionality in my game