Game Development Reference
In-Depth Information
Listing 9-26. Resetting the High Score Entry Menu
void ResetMenu()
{
m_CharacterSetIndex = 10;
m_EntryIndex = 0;
m_CurrentEntryPositionX = m_StartingEntryPositionX;
m_CurrentEntryPositionY = m_StartingEntryPositionY;
m_Text.SetText("...".toCharArray());
m_Text.RenderToBillBoard(m_HighScoreEntryMenuImage, m_CurrentEntryPositionX,
m_CurrentEntryPositionY);
m_EntryFinished = false;
The FindCurrentCharacter() function finds the character matching the user's current initial entry
selection and returns it. (See Listing 9-27.)
Listing 9-27. Finding the Currently Selected Initial
char FindCurrentCharacter()
{
BillBoardFont Font = m_Text.GetCharacter(m_CharacterSetIndex);
return Font.GetCharacter();
}
The ProcessEnterMenuSelection() function enters the currently selected initial as the entry for the
current player's name/initial position and increments the entry point to the next initial entry position.
The m_Dirty variable is also set to true, indicating the need to update the menu's billboard.
(See Listing 9-28.)
Listing 9-28. Processing the Menu Selection
void ProcessEnterMenuSelection()
{
char EnteredChar = FindCurrentCharacter();
m_Entry[m_EntryIndex] = EnteredChar;
m_EntryIndex++;
if (m_EntryIndex >= MAX_ENTRY_CHARACTERS)
{
m_EntryFinished = true;
}
m_CurrentEntryPositionX = m_CurrentEntryPositionX + m_FontWidth;
m_Dirty = true;
}
 
Search WWH ::




Custom Search