Creating the scene manager
Creating a scene manager that just swaps the engine's current scene for another scene is quite simple, but not graphically appealing to players. Showing a loading screen while resources load and the scene is constructed has become a well-accepted practice in game design because it lets the player know that the game is doing more than just idling.
Getting ready...
Open the SceneManager.java
class in this chapter's code bundle. Also, open the ManagedScene.java
and ManagedLayer.java
classes. We will be referencing all three of these classes throughout this recipe. The inline comments within the classes provide additional information to what is discussed throughout this recipe.
How to do it...
Follow these steps to understand how a SceneManager
class functions so that we can create a custom-tailored one for future projects:
First, notice that the
SceneManager
class is created as a singleton so that we can access it from anywhere in our project. Furthermore, it uses the...