Proper way to throw up a splash screen?

I’ve got a lot of data files and calculations being done in LoadContent(). I want to throw up a splash screen saying that various files are being loaded, thermometer, etc. But, you really can’t do that outside of Draw(GameTime gameTime).

Is there a proper way to do this? Or - and this seems a little ugly - use boolean flags and Update() to do a one time throw up a splash screen and load all the files and do calculations and then set the boolean flag to false and never deal with it again?

This is possible with multithreading. Essentially, in your LoadGame() function, do something like:

loadingThread = new Thread(() => LoadingFunction());
loadingThread.Start();

where ‘LoadingFunction()’ is a function that loads all your content then sets a global boolean to true.

The LoadGame() Function will execute and move on to your main game loop. In the loop, with whatever state management system you use, simply process your splashscreen until the global boolean is true. In which case, the loading thread has finished, and you can move on to the actual game.

Of course, you will have to load the content for the splash screen prior to the loading thread.

This has the added benefit of being able to animate the splash screen, or do whatever other logic or drawing you want in it.

Hope this helps

Thanks! With a bit of tweaking it worked great.
Now, for the next question… I want to put up messages like:

spriteBatch.Begin();
string tString = "Calculating Fog of War...";
spriteBatch.DrawString(Amaltea24, tString, new Vector2(400,500), Color.Black);
spriteBatch.End();

But it’s not drawing to the screen. In fact, I’ve never been able to get anything to draw to the screen except when it’s in Draw(GameTime gameTime). Is this the only place you should/can make draw calls?

That’s correct. Draw calls should only happen in the Draw method of your Game class. They can occur directly in said method and also in methods called by that method, and methods called by those methods, and so on. But as far as I know, a Draw call won’t work if it happens during the Update part of the Update/Draw loop.

Thanks! Got it!