Game Development Reference
In-Depth Information
The
RenderEntryToMenu()
function renders the currently selected character for the player's initials to
the entry menu. (See Listing 9-32.)
Listing 9-32. Rendering the Current Entry Selection
void RenderEntryToMenu()
{
char CurrentCharacter = FindCurrentCharacter();
String StringCharacter = CurrentCharacter + "";
RenderTextToMenu(StringCharacter, m_CurrentEntryPositionX, m_CurrentEntryPositionY);
}
The
GetEntryMenuStatus()
function tests the input screen coordinates
TouchX
and
TouchY
to
determine if the user has pressed a high score entry menu button. If he or she has, the button type is
returned. (See Listing 9-33.)
Listing 9-33. Getting the Entry Menu Status
EntryMenuStates GetEntryMenuStatus(float TouchX, float TouchY,int ViewPortWidth,int ViewPortHeight)
{
EntryMenuStates Selection = EntryMenuStates.None;
boolean Touched = false;
// Next character Menu Item
Touched = m_NextCharacterButton.Touched(TouchX, TouchY, ViewPortWidth, ViewPortHeight);
if (Touched)
{
Selection = EntryMenuStates.NextCharacterPressed;
}
// Previous character Menu Item
Touched = m_PreviousCharacterButton.Touched(TouchX, TouchY, ViewPortWidth, ViewPortHeight);
if (Touched)
{
Selection = EntryMenuStates.PreviousCharacterPressed;
}
// Enter Menu Item
Touched = m_EnterButton.Touched(TouchX, TouchY, ViewPortWidth, ViewPortHeight);
if (Touched)
{
Selection = EntryMenuStates.Enter;
}
return Selection;
}
The
UpdateHighScoreEntryMenu()
function updates all the components that make up the high score
entry menu, including the input character that the user has selected, the next character button, the
previous character button, the enter button, and the high score entry menu billboard. (See Listing 9-34.)