Game Development Community

how do you keep your gui buttons one place

by hbomega · in Torque 2D Beginner · 08/18/2013 (11:47 am) · 6 replies

my gui button changes position every time i re-size the window can someone please show me how i would go about fixing this

#1
08/18/2013 (3:03 pm)
Verify the HorizSizing and VerticalSizing properties of your GuiControl.
Verify Not only the properties of the buttons but the GuiControl which contains these buttons as well!

I always have to go back and experiment whenever I'm working with GUI's.

If you want to have a little more control, be sure to group your objects into Logical groups instead of placing everything on the main GuiControl.
I mean add GuiPaneControls, GuiStackControls, etc.

Most importantly, look at how the Sandbox Gui Controls are defined and noticed how they behave in-game.
#2
08/19/2013 (12:14 am)
thanks simon i got it another question how would you go about making a flashing PRESS START button is the flashing an animation or are you simply hiding it then making it visible again or is it something entirely different
#3
08/19/2013 (4:02 am)
There are several ways you could implement a flashing button. It could be an animated sprite, as you suggested. You could also use a static sprite and change its colors through blending. I have some sample toys available - see the AuidoBasicsToy for the button script and the FadeInOutToy for blending ideas.

github.com/t2Dtutorials/Modules
#4
08/25/2013 (8:22 am)
@ Mike i used guisprite to create my startup splash screens i wanted to incorporate the method used in the FadeIN/OUT toy my problem is i have no idea how or where to start. would i write over my startup splash screens implementing the Fade in/out toy method or is there a way to implement the fade in/out toys functionality into my gui based also i understand the color changing scheme making the flashing "press Start" button still i'm having a hard time understanding how to get them to work for my project
#5
08/25/2013 (8:46 am)
@hbomega : For the Gui fading, you can also use GuiFadeinBitmapCtrl, which is made exactly for what you describe.

The Gui fades in (according to fadeintime) then waits (according to waitTime) and fades back to black (according to fadeouttime).

simply call Canvas.pushdialog(%fader) to start it, and Canvas.popdialog(%fader) to remove it from the screen. In the example below, it is assumed that the function removefader contains the call to popdialog.

%fader =new GuiFadeinBitmapCtrl()
{
   bitmap = "^MyModule/assets/images/1234.png";
   fadeinTime = 1500;
   fadeoutTime = 2500;
   waitTime = 500;
};
Canvas.pushdialog(%fader);

schedule(4500,0,removefader);

One important note -> You must specify the image file, you cannot use Assets for this, like you can use in most other places.

When the gui field is named image, you can use Assets or specify the file directly.
When the gui field is named bitmap, you CANNOT use Assets and must specify the file directly.

Please describe what you don't understand about the "press Start" flashing button so that we may guide you properly. How would you do it?
#6
08/25/2013 (9:25 am)
@Simon: would i have to replace my GuiSpriteCtrl with GuiFadeinBitmapCtrl or would i create the fadein function and then call it before before displaying guisprites here is an example of what i have going on

unction loadStartup()
{
//called from init.cs
Canvas.pushDialog(Custom_StartupGui_StartupBG);//load the background
schedule(1000, 0, "Load_Startup_Back_Done");//schedule the game screen
}

function Load_Startup_Back_Done()
{
Canvas.pushDialog(Custom_StartupGui_HB);//load the Game screen
schedule(2000, 0, "Load_Startup_Game_Done");//schedule, the game screen
}



where should i difine the fade in function, is it defind like the other gui controls,