Game Development Reference
In-Depth Information
Modifying the MyGLRenderer Class
The MyGLRenderer class must be modified in order to integrate the main menu, high score table,
and high score entry menu.
The
GameState
enumeration (see Listing 9-36) holds the general state of the game, which can be one
of the following:
MainMenu
: The state where the main menu is being displayed
ActiveGamePlay
: The state where the game is active
HighScoreTable
: The state where the high score table is being displayed
HighScoreEntry
: The state where a player is entering his or her initials after making
a high score
Listing 9-36. The Game State
enum GameState
{
MainMenu,
ActiveGamePlay,
HighScoreTable,
HighScoreEntry
}
The
m_GameState
variable holds the state of the game.
private GameState m_GameState = GameState.MainMenu;
The
m_MainMenu
variable holds a reference to the MainMenu class object that implements the
main menu.
private MainMenu m_MainMenu;
The
m_HighScoreEntryMenu
variable holds a reference to the HighScoreEntryMenu class object that
implements the high score entry menu system.
private HighScoreEntryMenu m_HighScoreEntryMenu;
The
m_HighScoreTable
variable holds a reference to the class object that implements the high
score table.
private HighScoreTable m_HighScoreTable;
The
m_CanContinue
variable is true if there is a previously saved game that the user can
continue from.
private boolean m_CanContinue = false;