Problem OnFadeFinished
by Dany · in Torque X 2D · 07/12/2007 (11:52 am) · 2 replies
Hello,
I have a bug or problem with OnFadeFinished (GUIsplashscreen)
I try to load my level directly after the end of splashscreen, without load another Guiscreen (like tank buster)
my init is the following:
public SplashScreen()
{
// create the Style for our splash ad
GUISplashStyle splashStyle = new GUISplashStyle();
splashStyle.FadeInSec = 2; // black to image 2 seconds
//splashStyle.FadeOutSec = 2; // image to black 2 seconds
//splashStyle.FadeWaitSec = 4; // still image for 4 seconds
splashStyle.Bitmap = @"data\images\splashbg";
splashStyle.PreserveAspectRatio = true;
//splashStyle.Anchor = AnchorFlags.All;
// set some info for this control
Name = "SplashScreen";
Style = splashStyle;
Size = new SizeF(1024, 768);
OnFadeFinished = OnSplashFinished;
}
and the onsplashfinished method is :
public void OnSplashFinished()
{
Game.Instance.LoadLevel();
}
and load level in Game class
public void LoadLevel()
{
SceneLoader.Load(@"data\levels\mylevel.txscene");
}
First Bug if i try like this , it loop between onsplashfinished and loadlevel
I try to correct the problem with this line in on splashFinished
this.OnFadeFinished= null;
(Second Bug)
and it doesn't loop
it passthrough the processtick, but nothing is render to screen ? it still black
bug or Wrong Method ??
thanks for your help
I have a bug or problem with OnFadeFinished (GUIsplashscreen)
I try to load my level directly after the end of splashscreen, without load another Guiscreen (like tank buster)
my init is the following:
public SplashScreen()
{
// create the Style for our splash ad
GUISplashStyle splashStyle = new GUISplashStyle();
splashStyle.FadeInSec = 2; // black to image 2 seconds
//splashStyle.FadeOutSec = 2; // image to black 2 seconds
//splashStyle.FadeWaitSec = 4; // still image for 4 seconds
splashStyle.Bitmap = @"data\images\splashbg";
splashStyle.PreserveAspectRatio = true;
//splashStyle.Anchor = AnchorFlags.All;
// set some info for this control
Name = "SplashScreen";
Style = splashStyle;
Size = new SizeF(1024, 768);
OnFadeFinished = OnSplashFinished;
}
and the onsplashfinished method is :
public void OnSplashFinished()
{
Game.Instance.LoadLevel();
}
and load level in Game class
public void LoadLevel()
{
SceneLoader.Load(@"data\levels\mylevel.txscene");
}
First Bug if i try like this , it loop between onsplashfinished and loadlevel
I try to correct the problem with this line in on splashFinished
this.OnFadeFinished= null;
(Second Bug)
and it doesn't loop
it passthrough the processtick, but nothing is render to screen ? it still black
bug or Wrong Method ??
thanks for your help
About the author
Torque 3D Owner Will O-Reagan
Modern Intrigues
Basically, you have pre-empted the normal GUI which loads automatically in the typical starterkit. You have to set a brand new one.
Now, that explination could be TOTALLY off, but thats what i believe is the case.... And setting a new content control will let your scene get rendered.
I'll have a go at it off the top of my head, but this is by no means correct..
public void OnSplashFinished() { Game.Instance.LoadLevel(); GUISceneView _sceneview = new GUISceneView(); GUIStyle _guiStyle = new GUIStyle(); T2DSceneCamera _cam = new T2DSceneCamera(); _cam.name = "myCam"; _sceneview.Camera = _cam; _sceneview.Style = _guiStyle; _cam.Extent = new Vector2 (100, 80); GUICanvas.Instance.SetContentControl(_sceneView); }That should get you far enough that you can debug it and fill in the blanks of what you need. Or just reference one of the kits that set a GUI
Hope that helps.
WillO
MMI