More GUI hairpulling :)
by Rodney (OldRod) Burns · in Torque Game Engine · 06/07/2004 (6:08 pm) · 4 replies
I'm nearly bald now from all the frustration of messing with the GUI editor. well, that plus my age, but that's irrelevant :)
I have a background image that I'm using under my main menu. Scattered around the screen, in places that line up with the background image, are bitmap buttons. I sized and place them all in 800x600 and they are exactly where I want them.
Now comes the problem - switching resolutions messes them up. I don't mind if they change size, but they need to stay relative to where they were in 800x600 to look decent against the background.
I've tried every possible combination of "top" "bottom" "left" "right" "relative" and "center" on these buttons and they just won't behave.
Is there any way to make the line up with a static background, and stay lined up in various resolutions? Or am I fighting a losing battle?
I have a background image that I'm using under my main menu. Scattered around the screen, in places that line up with the background image, are bitmap buttons. I sized and place them all in 800x600 and they are exactly where I want them.
Now comes the problem - switching resolutions messes them up. I don't mind if they change size, but they need to stay relative to where they were in 800x600 to look decent against the background.
I've tried every possible combination of "top" "bottom" "left" "right" "relative" and "center" on these buttons and they just won't behave.
Is there any way to make the line up with a static background, and stay lined up in various resolutions? Or am I fighting a losing battle?
#2
Anyway, I found a combination of top/bottom left/right that finally gets it really close in all resolutions. It's on my list to tinker with this later though, because this is hardly intuitive :)
06/08/2004 (2:57 am)
Well, I finally got it close. I must not have tried *every* combination last night (or I did, but forgot to hit 'apply' :)Anyway, I found a combination of top/bottom left/right that finally gets it really close in all resolutions. It's on my list to tinker with this later though, because this is hardly intuitive :)
#3
07/04/2004 (4:35 am)
Just a thought, if you can organize your main screen to have the buttons in the upper left more and set things up for a 640/480 base screen since they are positioned from top and left would they not still appear in the proper place on all resolutions above that?
#4
Hopefully later on, I can come up with a better more permanent solution :)
07/04/2004 (4:49 am)
Thanks, but I got it working fairly well for now. It took a lot of playing around and experimentation, but what I finally ended up with is a series of 6 buttons arranged in a circular pattern around the screen. Each button is set relative to the top/bottom/center and/or left/right/center (depending on where it's at) so that it doesn't move much when the resolution changes. They are not exact, and they do move some, but they still line up with the underlying graphic in resolutions from 640x480 up to 1280x1024, so that's good enough for now.Hopefully later on, I can come up with a better more permanent solution :)
Torque Owner Stephen Clark
What I ended up doing myself is defining everything's placement as a percentage and grabbing the screen's X an Y size beforehand. This will make a GUI object named blackbox reposition/resize, and if you dont know, getWord(
$x=getWord($pref::Video::resolution,0);
$y=getWord($pref::Video::resolution,1);
echo("screenx:" SPC $x SPC "screeny:" SPC $y);
blackbox.resize(0, $y * 0.42, 20, 60);
I know, it seems it would know how to do this, but its relative positioning is measured in terms of the edges or something like that...
good luck!
-s