Problem with splash screen
by Viktor Rumanuk · in Torque X 2D · 10/20/2007 (4:09 pm) · 14 replies
I'm using Dro's tutorial to create a splash screen for my game. My problem is that my actual game won't load after the splash screen is finished. The OnSplashFinished function is being called and I have the right path to the file. Suggestions?
Thanks, Viktor
Thanks, Viktor
#2
public void OnSplashFinished()
{
StarterGame.Game.Instance.SceneLoader.Load(@"data\levels\levelData.txscene");
}
10/21/2007 (8:03 am)
Here it is:public void OnSplashFinished()
{
StarterGame.Game.Instance.SceneLoader.Load(@"data\levels\levelData.txscene");
}
#3
GUIUtil.InitGUIScreens("StarterGame");
GUICanvas.Instance.SetContentControl("GuiSplashScreen");
with:
StarterGame.Game.Instance.SceneLoader.Load(@"data\levels\levelData.txscene");
does the scene load normally? This can help determine if its a problem with the splash screen/canvas versus a problem with the level file.
John K.
10/21/2007 (9:38 am)
It looks right, what actually happens when the splash screen fades to black? Do you hit an assert/exception, or does the screen just stay black permanently with no errors? Also, how do you know it reached the OnSplashFinished() method, did you set a breakpoint? Also, if you rip out the splash screen by editing the BeginRun() method and commenting out:GUIUtil.InitGUIScreens("StarterGame");
GUICanvas.Instance.SetContentControl("GuiSplashScreen");
with:
StarterGame.Game.Instance.SceneLoader.Load(@"data\levels\levelData.txscene");
does the scene load normally? This can help determine if its a problem with the splash screen/canvas versus a problem with the level file.
John K.
#4
10/21/2007 (9:55 am)
The screen just stays black. Yes, I set a breakpoint. The scene does load normally when I comment out those lines.
#5
John K.
10/21/2007 (2:27 pm)
I can't seem to reproduce this problem. If the OnSplashFinished() is being reached and we know that SceneLoader.Load() successfully loads the level, then the only area left to investigate is the Canvas. Do you have your own gameplay screen that derrives from GUISceneview? Maybe there is some sort of Canvas initialization problem.John K.
#6
10/21/2007 (6:41 pm)
Not to my knowledge. I am just trying to get this to work with the rainy day tutorial. Thanks for your help thus far.
#7
John K.
10/21/2007 (8:25 pm)
Can you .zip up the project and email to me? My email address jkanalakis AT envygames DOT com. I can try to reproduce on my computer. If it works fine, then there might be an overall configuration problem on your side.John K.
#8
10/21/2007 (8:47 pm)
Ok sent.
#10
That ought to do it.
John K.
10/21/2007 (10:25 pm)
As I suspected, it looks like the GUICanvas was not being set. Think about the GuiCanvas as a painting canvas that can only have one rendering displayed at a time. By default, a Torque X project has a blank canvas ready to render a scene. But, when you added the splash screen, you replaced the GUICanvas with a GUISplash. When that splash screen ends, and the OnSplashFinished() method is reached, there's no renderable canvas, so you need to create one. Add the following to your OnSplashFinished() method.public void OnSplashFinished()
{
//load the txscene level file
StarterGame.Game.Instance.SceneLoader.Load(@"data\levels\levelData.txscene");
//create a renderable canvas for the scene
GUIStyle stylePlayGui = new GUIStyle();
GUISceneview playGui = new GUISceneview();
playGui.Style = stylePlayGui;
//switch over to the new canvas
GUICanvas.Instance.SetContentControl(playGui);
} That ought to do it.
John K.
#11
Edit: Worked like a charm, thanks again.
10/22/2007 (9:47 am)
Thanks a lot, I'll try this when I get home.Edit: Worked like a charm, thanks again.
#12
BTW: Was the tutorial easy to follow/understand?
10/22/2007 (6:50 pm)
Sorry guys for the confusion. I thought I had added that code before, but guess that was in the first version of the tutorial :(. I'm really sorry and thank you Viktor for adding in the code. BTW: Was the tutorial easy to follow/understand?
#13
10/22/2007 (7:10 pm)
No problem, mistakes are made, especially in a wiki. Thanks for taking the time to put the tutorial up. Very helpful for the GUI noob :).
#14
I actually had this same exact problem and it helped alot.
Thank you
11/26/2009 (4:16 am)
Thank you jonh, I actually had this same exact problem and it helped alot.
Thank you
Associate John Kanalakis
EnvyGames
John K.