Game Development Community

GuiXFadeBitmapCtrl

by Chris "C2" Byars · in Torque Game Engine · 05/02/2006 (2:19 pm) · 5 replies

I use the GuiXFadeBitmapCtrl for an excellent bitmap fading GUI, however I use this paired with my weapon HUD image script, which calls "setBitmap" for each weapon when you swap weapons. Problem is, the GuiXFadeBitmapCtrl's bitmap fades out and doesn't come back. I need it to appear each time setBitmap is called, so the HUD image fades in then out nicely.

I'm not so great at the source, but if I can take some pointers I'm sure I could do this.

Thanks! :)

#1
05/02/2006 (7:29 pm)
I notice if I open or close the GUI or Mission Editor, that the bitmap restarts/reloads so that its fade in/out sequence plays. All I need is something to reset the GUI or tell it to update or something when the setBitmap function is called or something like that.
#3
05/07/2006 (6:21 am)
You only need to set wakeTime to the current time and it starts fading again.

Find this line:
IMPLEMENT_CONOBJECT(GuiXFadeBitmapCtrl);

Add this right after it:

ConsoleMethod(GuiXFadeBitmapCtrl, reset, void, 2, 2, "reset() re-starts the fade")
{
	object->wakeTime = Platform::getRealMilliseconds();
	object->done = false;
}

Then just call the reset() method on any GuiXFadeBitmapCtrl to make it start fading again.
#4
05/07/2006 (6:49 am)
Whoa thanks :D
#5
05/07/2006 (7:11 am)
Now it doesn't fade at all, no matter if I have "weaponHUD.reset();" or not.

Edit: Actually it appears it doesn't fade even without your addition. Guess it's not compatible with TSE MS3/TGE 1.4. Looks like someone left a comment on that resource page even asking for an update to work with TGE 1.4 (TSE MS3).