Screen Fader GUI Control
by Martin Schultz · 12/31/2007 (2:30 pm) · 10 comments
Download Code File
This is a new black overlay control for TGE which can be used to fade in or out from or to black. Nice effect for example if you start your game, the screen is totally black and slowly fades in and shows your game.
1) Add the C++ class guiScreenFaderCtrl to your engine project and do a fresh compile of your project.
2) Add as example to the playgui as LATEST item the gui control that is in the incluced file "guiTest.gui".
3) Now start your game and open the console. Type in "GameScreenfader.fadeIn();" and press return and see how the screen fades in. The opposite is "GameScreenfader.fadeOut();"
There are support function to set the fade time value or setting the alpha value manually.
Have fun with this control.
Martin :-)
This is a new black overlay control for TGE which can be used to fade in or out from or to black. Nice effect for example if you start your game, the screen is totally black and slowly fades in and shows your game.
1) Add the C++ class guiScreenFaderCtrl to your engine project and do a fresh compile of your project.
2) Add as example to the playgui as LATEST item the gui control that is in the incluced file "guiTest.gui".
3) Now start your game and open the console. Type in "GameScreenfader.fadeIn();" and press return and see how the screen fades in. The opposite is "GameScreenfader.fadeOut();"
There are support function to set the fade time value or setting the alpha value manually.
Have fun with this control.
Martin :-)
#2
01/01/2008 (5:02 am)
Its main purpose is for switching GUI screens from one to another with a black fade out/in.
#3
I downloaded your code, but after extracting i found out that there is nothing inside "guiTest.gui" file.
Is it intentional ??
Sorry this may sound stupid question but am very new to torque :)
Can you provide me with code for that gui file so that i can test it?
Thanks Martin :)
01/06/2008 (11:58 pm)
Hi Martin, I downloaded your code, but after extracting i found out that there is nothing inside "guiTest.gui" file.
Is it intentional ??
Sorry this may sound stupid question but am very new to torque :)
Can you provide me with code for that gui file so that i can test it?
Thanks Martin :)
#4
01/07/2008 (6:45 am)
Doh! You're right, it's missing. Here is the example for the GUI control:new GuiScreenFaderCtrl(GameScreenfader) {
profile = "GuiDefaultProfile";
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
fadeTime = "700";
alpha = "255";
color = "0 0 0 0";
};
#5
BTw, void GuiScreenFaderCtrl::onRender(..) function is not getting called :(
u have any idea why? evn am debugging :)
Thx.
01/07/2008 (10:38 pm)
Hey thanks for the update .. i have added it...BTw, void GuiScreenFaderCtrl::onRender(..) function is not getting called :(
u have any idea why? evn am debugging :)
Thx.
#6
01/08/2008 (12:43 am)
I'm sure it is called, otherwise it would not do it's effect.. :-) Check if you have enabled the control or have it disabled!
#7
Now here's wht i have done so far... Included .h & .cpp file. Created its object in the script cs file using wht u gave me :)
Now once game is started am doing.. GameScreenfader.fadeIn( )
now this should eventually do the fade in effect as expected. when i see console log i get console entry abt fadeIn( ) but no entry about onRender( ) call.
when u say i have to enable the control wht does tht mean exactly? any flag while creating object in script or anything different?
May b sound noob to u ...but wana advance frm this step.
thx again :)
01/08/2008 (1:59 am)
Hi Martin,Now here's wht i have done so far... Included .h & .cpp file. Created its object in the script cs file using wht u gave me :)
Now once game is started am doing.. GameScreenfader.fadeIn( )
now this should eventually do the fade in effect as expected. when i see console log i get console entry abt fadeIn( ) but no entry about onRender( ) call.
when u say i have to enable the control wht does tht mean exactly? any flag while creating object in script or anything different?
May b sound noob to u ...but wana advance frm this step.
thx again :)
#8
Thanks for this resource :) I got it working finally in my game. Actually since i have missions in my game, every mission has its own playgui.gui file. I created object in other gui file n was using it in another :D
also, When i commented calling Parent::onrender( ) it started wrking for me.
Thanks for all the help :)
cheers!
01/09/2008 (4:39 am)
Hi Martin,Thanks for this resource :) I got it working finally in my game. Actually since i have missions in my game, every mission has its own playgui.gui file. I created object in other gui file n was using it in another :D
also, When i commented calling Parent::onrender( ) it started wrking for me.
Thanks for all the help :)
cheers!
#9
I am tring your code for TGEA 1.8.1 and it seems bit confusion for me. In guiScreenFaderCtrl.cc file you included #include "dgl/dgl.h" . but I couldn't find dgl.h file anywhere in my project. there is no such dgl folder and dgl.h file even. One more thing you mentioned .cc file but in my project all are .cpp files.
So I can get you code working with TGEA 1.8.1. Please help me. It will be a great help.
Thanking you.
05/25/2009 (7:37 pm)
Hi Martin,I am tring your code for TGEA 1.8.1 and it seems bit confusion for me. In guiScreenFaderCtrl.cc file you included #include "dgl/dgl.h" . but I couldn't find dgl.h file anywhere in my project. there is no such dgl folder and dgl.h file even. One more thing you mentioned .cc file but in my project all are .cpp files.
So I can get you code working with TGEA 1.8.1. Please help me. It will be a great help.
Thanking you.
#10
05/25/2009 (9:34 pm)
Sorry, no idea, haven't played yet with 1.8x. 
Torque Owner Cinder Games