Drawing a loading screen during level loads with Xna draw fn
by Raymond Ku · in Torque X 2D · 03/25/2010 (12:08 pm) · 5 replies
I'm attempting to make a splash screen during level loading.
At the same time i've been trying to get
tdn.garagegames.com/wiki/TorqueX/SplashScreen
to run.
Currently when i create my main menu GUI, i load a blank txscene, otherwise _myGame.Run(); produces null reference exception handler.
With the splash screen, the game also will produce an null reference exception handler if i just add the code from the tutorial to my Game.cs
I added a blank txscene again and the splash screen will not show up.
When dealing with GUIcanvas.instance.Setcontrol is it necessary to have a txscene loaded already?
Also assuming i can get a splash screen to display, it seems there are no ways to display animated sprites in the GUI. I was wondering if there is anyway to access the XNA draw loop and just draw my own animated sprite class while SceneLoader is loading a new level.
sorry if my understanding of how torque and xna function are somewhat incoherent/incorrect.
At the same time i've been trying to get
tdn.garagegames.com/wiki/TorqueX/SplashScreen
to run.
Currently when i create my main menu GUI, i load a blank txscene, otherwise _myGame.Run(); produces null reference exception handler.
With the splash screen, the game also will produce an null reference exception handler if i just add the code from the tutorial to my Game.cs
I added a blank txscene again and the splash screen will not show up.
When dealing with GUIcanvas.instance.Setcontrol is it necessary to have a txscene loaded already?
Also assuming i can get a splash screen to display, it seems there are no ways to display animated sprites in the GUI. I was wondering if there is anyway to access the XNA draw loop and just draw my own animated sprite class while SceneLoader is loading a new level.
sorry if my understanding of how torque and xna function are somewhat incoherent/incorrect.
About the author
http://cip-game.blogspot.com
#2
I'm having a similar problem but I can't seem to get your fix to work.
Would you mind explaining more about what you did?
/Thomas
11/19/2010 (1:24 pm)
Hey RaymondI'm having a similar problem but I can't seem to get your fix to work.
Would you mind explaining more about what you did?
/Thomas
#3
11/19/2010 (2:16 pm)
@Raymond: you can override the XNA Draw() in your Game class. Alternatively, if you have access to the CEV version of Torque X then you can use the AsyncSceneLoader class to load one scene while another is displaying animation.
#4
Next, you should be able to have some utility function, where you basically put the image to the screen, wait a couple of "process ticks", (maybe even do this with a torque object), then remove the GUI screen from the canvas..
The removal code should look something like this.
But Duncan's Asnychonous loader is pretty good too, I just started using it myself, and can be found in the CEV.
11/19/2010 (5:19 pm)
Thomas, #1 thing, is you should be able to create a GUI Screen with just an image on it. Theres examples all over the place.Next, you should be able to have some utility function, where you basically put the image to the screen, wait a couple of "process ticks", (maybe even do this with a torque object), then remove the GUI screen from the canvas..
The removal code should look something like this.
//add the loading screen to the canvas LoadingScreen.Instance.GUI.Folder = GUICanvas.Instance;
//remove the loading screen from the canvas LoadingScreen.Instance.GUI.Folder = new TorqueFolder();Where LoadingScreen.GUI should be some kind of Viewable GUI element of some sort...
But Duncan's Asnychonous loader is pretty good too, I just started using it myself, and can be found in the CEV.
#5
11/22/2010 (9:12 am)
Thanks a bunch. That did the trick :)
Torque Owner Raymond Ku
no studio
Turns out when i set my guicanvas to my menu UI in beginrun() it was replacing the splashscreen guicanvas.
However in order to get the splash screen to work
I loaded a blank txscene before the code for the splash screen and then in OnSplashFinished() i have to load the blank txscene once again (I had tried commenting this out to avoid loading twice, but it did not run)
does guisplash remove unload the current txscene when onfaded is reached?
Does that mean I can not have guisplash actually displaying anything while I'm using Sceneloader to load my actual level?