Splash Screen Manager control - guiSplashMgrCtrl
by Ryan Mick · 08/19/2009 (3:48 pm) · 90 comments
What is it?
The guiSplashMgrCtrl is a GUI control for creating multiple splashes in TGE/TGEA/T3D. The guiSplashMgrCtrl control uses child controls that inherit from a base guiSplashItemCtrl which encompasses most of the base functionality for showing a splash item. Included in this is the guiSplashBitmapCtrl which fades a bitmap in and out over defined times.
What it does
By extending the guiSplashItemCtrl and creating the guiSplashBitmapCtrl you will be able to use this to present your users with sequential or randomized splash items when your game loads or by utilizing it in playgui you can create effects like count downs or blood splatters. Splash items can be randomly shown with a simple console call.
Extendable
Creating your own splash items is easy. All you have to do is make sure you inherit from guiSplashItemCtrl. You will then want to override the following methods for your needs:
onRenderDesignTime
onRenderNormal
calcNewBounds
Look at the guiSplashBitmapCtrl (included in the zip) for an example of how to create your own controls.
Download
In the video below you can see the Splash Manager in action in 2 scenarios. The first is a an intro splash showing 3 splash items ( I used the same image for all 3). The next section is to create blood splatter effects over the playGui when ever the player takes damage. When the player takes damage a random splash item is shown (out of 5 profiled) and then it slowly fades away. The fade in and out times are configurable to your needs.
Now to work on migrating all my GUI controls to T3D.
The guiSplashMgrCtrl is a GUI control for creating multiple splashes in TGE/TGEA/T3D. The guiSplashMgrCtrl control uses child controls that inherit from a base guiSplashItemCtrl which encompasses most of the base functionality for showing a splash item. Included in this is the guiSplashBitmapCtrl which fades a bitmap in and out over defined times.
What it does
By extending the guiSplashItemCtrl and creating the guiSplashBitmapCtrl you will be able to use this to present your users with sequential or randomized splash items when your game loads or by utilizing it in playgui you can create effects like count downs or blood splatters. Splash items can be randomly shown with a simple console call.
Extendable
Creating your own splash items is easy. All you have to do is make sure you inherit from guiSplashItemCtrl. You will then want to override the following methods for your needs:
onRenderDesignTime
onRenderNormal
calcNewBounds
Look at the guiSplashBitmapCtrl (included in the zip) for an example of how to create your own controls.
Download
In the video below you can see the Splash Manager in action in 2 scenarios. The first is a an intro splash showing 3 splash items ( I used the same image for all 3). The next section is to create blood splatter effects over the playGui when ever the player takes damage. When the player takes damage a random splash item is shown (out of 5 profiled) and then it slowly fades away. The fade in and out times are configurable to your needs.
Now to work on migrating all my GUI controls to T3D.
About the author
#42
08/24/2009 (6:02 pm)
I think that calls for a video.
#43
Good news! It all seems to be working as expected!
I noticed that in your setup document, the TGE and TGEA comments for the blood splat effect are the wrong way around i.e. the TGEA part refers to "PLAYERDATA::onDamage", whereas TGEA uses the "Armor::onDamage" method.
Not a big deal but it did confuse me for a minute or two!
Cheers,
Rich H.
08/25/2009 (6:41 am)
Hey!Good news! It all seems to be working as expected!
I noticed that in your setup document, the TGE and TGEA comments for the blood splat effect are the wrong way around i.e. the TGEA part refers to "PLAYERDATA::onDamage", whereas TGEA uses the "Armor::onDamage" method.
Not a big deal but it did confuse me for a minute or two!
Cheers,
Rich H.
#44
08/25/2009 (12:37 pm)
Doh! I will fix it when I push out the T3D version.
#45
I'll upload the texture and explain how I got it to work.
I've decided to go with a shader effect for this for myself, so I dont need it.
08/25/2009 (1:07 pm)
busy uploading a video now of the waterdrops gui screen,I'll upload the texture and explain how I got it to work.
I've decided to go with a shader effect for this for myself, so I dont need it.
#46
in your player script, in
add this function under the onLeaveLiquid function:
GUI:
add one of these to the playgui.gui, before the last };
static:
animated:
this gives you an animated effect, or a static image effect, like in the video.
oh, nearly forgot, here are the files.
08/25/2009 (1:54 pm)
in your player script, in
function Armor::onLeaveLiquid(%this, %obj, %type)add this:
commandToClient(%obj.client,'ShowWetScreen');
add this function under the onLeaveLiquid function:
function clientCmdShowWetScreen(%client)
{
wetScreenMgr.showRandomSplash();
}GUI:
add one of these to the playgui.gui, before the last };
static:
new guiSplashMgrCtrl(wetScreenMgr) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
//Profile = "guiSplashMgrCtrlProfile";
HorizSizing = "center";
VertSizing = "center";
position = "0 0";
Extent = "1680 1050";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
RenderMode = "Random";
AutoStart = "0";
new guiSplashBitmapCtrl() {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
HorizSizing = "center";
VertSizing = "center";
position = "325 225";
Extent = "1680 1050";
MinExtent = "8 2";
canSave = "1";
Visible = "0";
hovertime = "1000";
fadeinTime = "500";
waitTime = "1000";
fadeoutTime = "2000";
done = "0";
fitscreen = "1";
bitmap = "./water_spray/drops.png";
};
};animated:
new guiSplashMgrCtrl(wetScreenMgr) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
//Profile = "guiSplashMgrCtrlProfile";
HorizSizing = "center";
VertSizing = "center";
position = "0 0";
Extent = "1680 1050";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
RenderMode = "Random";
AutoStart = "0";
new guiSplashAnimBitmapCtrl() {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
HorizSizing = "center";
VertSizing = "center";
Position = "110 161";
Extent = "1680 1050";
MinExtent = "8 2";
canSave = "1";
Visible = "0";
hovertime = "1000";
fadeinTime = "500";
waitTime = "1000";
fadeoutTime = "2000";
animationRate = "90";
fitscreen = "1";
bitmap = "./water_spray/wet_dripping1/wet_dripping1.dml";
};
};this gives you an animated effect, or a static image effect, like in the video.
oh, nearly forgot, here are the files.
#47
08/25/2009 (2:40 pm)
That is cool.
#48
08/28/2009 (2:44 am)
Ok, updated with a T3D version and updated documents.
#49
08/28/2009 (10:08 pm)
The water spray works awesome............Thanx
#50
08/29/2009 (3:38 am)
Thanx Highground??
#51
Thank you so much Ryan!
btw: thanks for the demo code on a WaterSplash Effect deepscratch, heres some more demo code. :)
TGE1.5.2: BloodSplat based on Damage Flash
In Armor::onDamage, Under: %obj.setDamageFlash(%flash);
This is what I'm using and it seems satisfactory!
09/02/2009 (1:56 am)
Awesome, Nice work further updating the resource, I still have the resource version prior to the SplashAnim upgrade and I'm still loving it anyway... I'll upgrade eventually lol.Thank you so much Ryan!
btw: thanks for the demo code on a WaterSplash Effect deepscratch, heres some more demo code. :)
TGE1.5.2: BloodSplat based on Damage Flash
In Armor::onDamage, Under: %obj.setDamageFlash(%flash);
//I used this echo to find an "ok" %flash value
//echo("c4Damage Flash Value: " @ %flash);
// If the pain is excessive, let's see and hear it.
if (%flash > "0.3")
{
//Play Pain Sound Effect
%obj.playPain();
//Show Blood Splat
commandToClient(%obj.client,'ShowBloodSplat');
}This is what I'm using and it seems satisfactory!
#52
and all of gResouceManager code is noted in T3D ver 1.0
how can i replace this code?
10/16/2009 (7:24 am)
T3D Release ver 1.0 dosent find gResourceManager in guiSplashAnimBitmapCtrl.cppand all of gResouceManager code is noted in T3D ver 1.0
how can i replace this code?
#53
10/20/2009 (4:59 pm)
Sorry for being MIA for a while. Between work and my wife being sick I haven't had much time lately. I have downloaded the latest T3D and will see what is going on. It worked in beta 5 and I wouldn't expect them to rename a bunch of variables like that. Did you modify your file at all? Can you post your build log?
#54
10/21/2009 (3:18 am)
Ok, it looks like they changed how that from B5 to 1.x. I have updated the files and uploaded them to the server. Get the latest zip file for the updates and let me know if you have any problems.
#55
01/14/2010 (8:10 pm)
Trying to build this into 1.1 Alpha and I am getting this error. 1>..\..\..\..\..\Engine\source\gui\game\guiSplashBitmapCtrl.cpp(124) : error C2665: 'ConsoleObject::addProtectedField' : none of the 2 overloads could convert all the argument types 1> D:/Torque/Torque 3D 2009 Pro 1.1 Alpha/Engine/source/console/consoleObject.h(702): could be 'void ConsoleObject::addProtectedField(const char *,const U32,const dsize_t,AbstractClassRep::SetDataNotify,AbstractClassRep::GetDataNotify,const U32,const EnumTable *,const char *)' 1> D:/Torque/Torque 3D 2009 Pro 1.1 Alpha/Engine/source/console/consoleObject.h(719): or 'void ConsoleObject::addProtectedField(const char *,const U32,const dsize_t,AbstractClassRep::SetDataNotify,AbstractClassRep::GetDataNotify,const char *)' 1> while trying to match the argument list '(const char [7], S32, dsize_t, bool (__cdecl *)(void *,const char *), const char *(__cdecl *)(void *,const char *), const char [1])'
#56
02/01/2010 (7:04 pm)
@Sean, sorry I didn't get to this earlier. Been really busy with personal issues lately. I have updated the zip file with the fix. Let me know if you have any questions.
#57
EDIT : sorry i've solve it just replace
03/19/2010 (4:55 am)
i get the same error with Sean when trying to build in T3D 1.0.1, is any fix for this??EDIT : sorry i've solve it just replace
addProtectedField( "bitmap", TypeStringFilename, Offset( mBitmapName, guiSplashBitmapCtrl ), &setBitmapName, &defaultProtectedGetFn, "Bitmap to display." );with
addField( "bitmap", TypeFilename, Offset(mBitmapName, guiSplashBitmapCtrl ) );
#58
from
to
Then in the same file change the line 127 from this
03/19/2010 (8:17 am)
You will need to correct the following code in guiSplashbitmapCtrl.cppfrom
#include "gui//editor/guiEditCtrl.h"
to
#include "gui/editor/guiEditCtrl.h"
Then in the same file change the line 127 from this
addProtectedField( "bitmap", TypeStringFilename, Offset( mBitmapName, guiSplashBitmapCtrl ), &setBitmapName, &defaultProtectedGetFn, "Bitmap to display." );
addField( "bitmap", TypeFilename, Offset( mBitmapName, guiSplashBitmapCtrl ));
#59
Going off of memory there and hopefully looking at a backup of the code. It should be basically the same as used in the GuiBitmapCtrl.
03/19/2010 (8:22 am)
The syntax changed from 1.0.1 to 1.1. The current code is for 1.1 which now means that it doesn't work for 1.0.1 without reverting that one line of code. I believe for 1.0.1 it should be:addProtectedField( "bitmap", TypeFilename, Offset( mBitmapName, guiSplashBitmapCtrl ), &setBitmapName, &defaultProtectedGetFn, "" );
Going off of memory there and hopefully looking at a backup of the code. It should be basically the same as used in the GuiBitmapCtrl.
#60
03/19/2010 (8:30 am)
When I use this statement 1.0 or 1.1 I just repeatedly get the error listed above. The only way I can get it to compile (and it does work) is to change it to the second set of code. Unfortunately, I cannot tell you what effect this has since I am not very good with C++. addProtectedField( "bitmap", TypeFilename, Offset( mBitmapName, guiSplashBitmapCtrl ), &setBitmapName, &defaultProtectedGetFn, "" );
addField( "bitmap", TypeFilename, Offset( mBitmapName, guiSplashBitmapCtrl ));

Torque Owner deepscratch
DeepScratchStudios