In this recipe, we'll develop a loading screen along with a controller for the game. It'll cover the most important aspects of the loading screen, such as showing a text and image for what it's loading and an indicator that shows the system is working.
Before starting this, it's recommended that you have a basic understanding of how to set up Nifty in an application and how to create screens and controllers. Have a look at the previous recipe, Initializing Nifty managing an options menu, if you are unsure about this.
We begin by creating the XML for the loading screen. Perform the following nine steps to do this:
Create a new file called
loadingScreen.xml
and loadNifty-default-styles
andNifty-default-controls
. Optionally, we can also includeoptionsMenu
from the previous recipe.The first element we need is a
<screen>
element:<screen id="loadingScreen" controller="gui.controller.LoadingScreenController">