Game Development Reference
In-Depth Information
3. If the high score entry menu is being displayed, process the menu item
being clicked.
a. If the next character button was clicked, call
ProcessNextMenuSelection()
.
b. If the previous character button was clicked, call
ProcessPreviousMenuSelection()
.
c. If the enter button was clicked, call
ProcessEnterMenuSelection()
to process it. If the
entry was complete, add the new high score to the high score table and set the game
state to display the high score table.
The
onDrawFrame()
function has to be modified to update and render the main menu, the high score
table, and the high score entry menu, based on the
m_GameState
variable. (See Listing 9-43.)
Listing 9-43. Modifying the
onDrawFrame()
Function
if (m_GameState == GameState.MainMenu)
{
m_MainMenu.UpdateMenu(m_Camera);
m_MainMenu.RenderMenu(m_Camera, m_PointLight, false);
return;
}
// High Score Table
if (m_GameState == GameState.HighScoreTable)
{
m_HighScoreTable.UpdateHighScoreTable(m_Camera);
m_HighScoreTable.RenderHighScoreTable(m_Camera, m_PointLight, false);
return;
}
// High Score Entry
if (m_GameState == GameState.HighScoreEntry)
{
m_HighScoreEntryMenu.UpdateHighScoreEntryMenu(m_Camera);
m_HighScoreEntryMenu.RenderHighScoreEntryMenu(m_Camera, m_PointLight, false);
return;
}
Now, run the program. You should see the following main menu appear. (See Figure
9-1
.)