Bitmap Button Control
by Michael Schoonbrood · 02/01/2002 (9:02 am) · 9 comments
Download Code File
Follow these steps to include the files in your EXE:
- Open the Torque project in MSVC.
- Select the Torque Demo Files sample
- Open the Source Files Folder
- Open the Gui folder
- Right click on the Gui folder and select Add files to folder
- Select Files of type: All files
- Select "guiBitmapButtonCtrl.cc" and "guiBitmapButtonCtrl.h" and add them.
- You will also have to add a line to your guiBitmapCtrl.h.
Under:
- Build the new exe and run it!
In the gui editor you can now add the control.
- Press F10 on the title screen.
- Select "New Control" (2nd top left button)
- Select "guiBitmapButtonControl"
- Set the button to where you want it to appear
- In the bottom right part of the screen you see the button properties. Scroll down and fill in the 3 bitmap names. They should point to file names in your fps/client/ui dir (or anywhere else you want them).
Make sure you add all 3 bitmaps (the names can be the same), or nothing will show in certain events :)
Follow these steps to include the files in your EXE:
- Open the Torque project in MSVC.
- Select the Torque Demo Files sample
- Open the Source Files Folder
- Open the Gui folder
- Right click on the Gui folder and select Add files to folder
- Select Files of type: All files
- Select "guiBitmapButtonCtrl.cc" and "guiBitmapButtonCtrl.h" and add them.
- You will also have to add a line to your guiBitmapCtrl.h.
Under:
void setBitmap(const TextureHandle &handle);Add:
void setWrap(const bool wrap) { mWrap = wrap; }- Build the new exe and run it!
In the gui editor you can now add the control.
- Press F10 on the title screen.
- Select "New Control" (2nd top left button)
- Select "guiBitmapButtonControl"
- Set the button to where you want it to appear
- In the bottom right part of the screen you see the button properties. Scroll down and fill in the 3 bitmap names. They should point to file names in your fps/client/ui dir (or anywhere else you want them).
Make sure you add all 3 bitmaps (the names can be the same), or nothing will show in certain events :)
About the author
#2
02/01/2002 (10:30 am)
Lol no.. It is funny actually. Tim and I made it on the same day :)
#3
02/01/2002 (1:41 pm)
And I didn't see that michael was working on one till I was almost finished. :)
#4
02/07/2002 (5:53 pm)
What I find interesting in this is that these two controls are somewhat different in overall functionality. That is, both do things the other doesn't.
#5
"Unable to get the root Canvas." is fired.
Looks like a GuiBitmapCtrl has a mGroup of NULL.
Any ideas?
Thanks for the code
02/14/2002 (2:25 pm)
I followed the instructions step by step, but after pressing F10 to invoke the gui editor the assertion"Unable to get the root Canvas." is fired.
Looks like a GuiBitmapCtrl has a mGroup of NULL.
Any ideas?
Thanks for the code
#6
Can anyone tell me if this makes sense?
I added two virtuals from SimBase
void GuiBitmapButtonCtrl::onGroupAdd()
{
addObject(&mBitmapButtonUp);
addObject(&mBitmapButtonDown);
addObject(&mBitmapButtonActive);
}
void GuiBitmapButtonCtrl::onGroupRemove()
{
removeObject(&mBitmapButtonUp);
removeObject(&mBitmapButtonDown);
removeObject(&mBitmapButtonActive);
}
And I also need to check if my controls are already awake
// Wake all bitmap controls
if( !mBitmapButtonUp.isAwake() )
mBitmapButtonUp.onWake();
if( !mBitmapButtonDown.isAwake() )
mBitmapButtonDown.onWake();
if( !mBitmapButtonActive.isAwake() )
mBitmapButtonActive.onWake();
It works, but is it ok?
02/14/2002 (2:44 pm)
Ok, i found a workaround for my problem.Can anyone tell me if this makes sense?
I added two virtuals from SimBase
void GuiBitmapButtonCtrl::onGroupAdd()
{
addObject(&mBitmapButtonUp);
addObject(&mBitmapButtonDown);
addObject(&mBitmapButtonActive);
}
void GuiBitmapButtonCtrl::onGroupRemove()
{
removeObject(&mBitmapButtonUp);
removeObject(&mBitmapButtonDown);
removeObject(&mBitmapButtonActive);
}
And I also need to check if my controls are already awake
// Wake all bitmap controls
if( !mBitmapButtonUp.isAwake() )
mBitmapButtonUp.onWake();
if( !mBitmapButtonDown.isAwake() )
mBitmapButtonDown.onWake();
if( !mBitmapButtonActive.isAwake() )
mBitmapButtonActive.onWake();
It works, but is it ok?
#7
I will use Tims code and add the ButtonDown Bitmap myself.
02/15/2002 (3:22 am)
I figured out by myself that adding the GuiBitmapCtrls ist not the right way to do it.I will use Tims code and add the ButtonDown Bitmap myself.
#8
This might be a stupid question, but I'm pretty new to Torque.
Can anyone tell me how I can recompile the Torque?
Thanks in advance.
04/19/2005 (10:44 pm)
Hi, This might be a stupid question, but I'm pretty new to Torque.
Can anyone tell me how I can recompile the Torque?
Thanks in advance.
#9
Are you using eclipse? If you are using, select the project e click in Project on the Menu, select clean. So recompile your project.
06/30/2005 (4:33 am)
@ Kiatiikun Are you using eclipse? If you are using, select the project e click in Project on the Menu, select clean. So recompile your project.

Torque 3D Owner Xavier "eXoDuS" Amado
Default Studio Name