Assume that you are using the “scene” paradigm.
Lets say you want to load in a new scene.
Here are the steps
- Disable controls
- Fade the loading screen in
- Read the scene from a file
- Set the new scene
- Fade the loading screen out
- Re-enable controls
Here are some problems to consider:
-
Fading in and Fading out take time. How would you follow up on something that finishes in the future, specifically on another cycle of the game loop.
-
Since loading screens usually has some type of animation, you probably do not want to read the scene on the game loop thread. How would you execute it on another thread.
-
What class do you place the code for #1 and #2 in?
-
How do you test your approach?
I have already solved this for my own project. But I am curious into what others will say. Also, this took me 2 hours on thinking for organize thread execution. I hope no one else suffers from this problem.