Game Development Reference
In-Depth Information
Tex = new Texture[NumberTextures];
Tex[0] = TexEnterButton;
Scale = new Vector3(3.0f,1.0f,1.0f);
MenuItem EnterButton = CreateMenuItem(iContext, MenuItemMesh, MenuItemMeshEx, Material1,
NumberTextures, Tex, AnimateTextures, TimeDelay, Position, Scale, ObjectShader);
int StartingEntryXPos = 168;
int StartingEntryYPos = 100;
m_HighScoreEntryMenu = new HighScoreEntryMenu(NextCharacterButton, PreviousCharacterButton,
EnterButton, m_CharacterSet, HighScoreEntryMenuImage, StartingEntryXPos, StartingEntryYPos);
}
The CreateMenuItem() function creates a new MenuItem object. (See Listing 9-40.)
Listing 9-40. Creating a Menu Item
MenuItem CreateMenuItem(Context iContext, Mesh MenuItemMesh, eshEx MenuItemMeshEx, Material
Material1, int NumberTextures, Texture[] Tex, boolean AnimateTextures, float TimeDelay, Vector3
Position, Vector3 Scale, Shader ObjectShader)
{
MenuItem NewMenuItem = null;
NewMenuItem = new MenuItem(iContext, MenuItemMesh, MenuItemMeshEx, Tex, Material1,
ObjectShader);
NewMenuItem.SetAnimateTextures(AnimateTextures, TimeDelay, 0, NumberTextures-1);
NewMenuItem.m_Orientation.SetPosition(Position);
NewMenuItem.m_Orientation.SetScale(Scale);
NewMenuItem.GetObjectPhysics().SetGravity(false);
return NewMenuItem;
}
The CreateMainMenu() function creates the main menu for our game. The function also creates the
individual menu items within the main menu, such as the new game menu item, the continue game
menu item, the display high score table menu item, and the copyright menu item. (See Listing 9-41.)
Listing 9-41. Creating the Main Menu
void CreateMainMenu(Context iContext)
{
// Create New Game Button
Shader ObjectShader = new Shader(iContext, R.raw.vsonelight, R.raw.fsonelight); // ok
MeshEx MenuItemMeshEx = new MeshEx(8,0,3,5,Cube.CubeData, Cube.CubeDrawOrder);
Mesh MenuItemMesh = null;
// Create Material for this object
Material Material1 = new Material();
// Create Texture
int NumberTextures = 1;
Texture TexNewGameButton = new Texture(iContext,R.drawable.newgamebutton);
 
Search WWH ::




Custom Search