class Menus { int m_MenuIndex; //0 - no menu (in game) //1 - title screen //2 - instructions //3 - select difficulty //4 - miss! //5 - drink! //6 - win void Initialize() { m_MenuIndex = 1; } void Reset() { m_MenuIndex = 1; } void SetMiss() { m_MenuIndex = 4; } void SetDrink() { m_MenuIndex = 5; } void SetWin() { m_MenuIndex = 6; } void Draw() { noTint(); switch( m_MenuIndex ) { case 1: DrawTitle(); break; case 2: DrawInstructions(); break; case 3: DrawDifficulty(); break; case 4: DrawMiss(); break; case 5: DrawDrink(); break; case 6: DrawWin(); break; } } void DrawTitle() { image( IMAGE_POOL.m_Images[14], 28, 67 ); fill( 0, 0, 0 ); textFont( IMAGE_POOL.m_Fonts[1], 32 ); text( "Beer Pong", 26, 210 ); fill( 255, 255, 255 ); textFont( IMAGE_POOL.m_Fonts[0], 16 ); text( "Click To Start", 45, 365 ); } void DrawInstructions() { fill( 255, 255, 255 ); textFont( IMAGE_POOL.m_Fonts[0], 16 ); text( " - Drag the hand", 38, 170 ); text( " left or right for aim.", 13, 190 ); text( " - Pull the hand", 40, 220 ); text( " back for power.", 30, 240 ); } void DrawDifficulty() { fill( 255, 255, 255 ); textFont( IMAGE_POOL.m_Fonts[0], 16 ); text( "CBA Member (easy)", 29, 180 ); text( "Veteran (medium)", 36, 205 ); text( "Lightweight (hard)", 32, 230 ); //check for rollover if( mouseX > 20 && mouseX < 180 ) { if( mouseY > 165 && mouseY < 185 ) { fill( 255, 0, 0 ); text( "CBA Member (easy)", 29, 180 ); } else if( mouseY > 190 && mouseY < 210 ) { fill( 255, 0, 0 ); text( "Veteran (medium)", 36, 205 ); } else if( mouseY > 215 && mouseY < 235 ) { fill( 255, 0, 0 ); text( "Lightweight (hard)", 32, 230 ); } } } void DrawMiss() { image( IMAGE_POOL.m_Images[15], 32, 153 ); fill( 0, 0, 0 ); textFont( IMAGE_POOL.m_Fonts[1], 32 ); text( "Miss!", 65, 280 ); if( mouseY > 375 ) { fill( 255, 0, 0 ); } else { fill( 255, 255, 255 ); } } void DrawDrink() { image( IMAGE_POOL.m_Images[16], 44, 120 ); fill( 0, 0, 0 ); textFont( IMAGE_POOL.m_Fonts[1], 32 ); text( "Drink!", 60, 280 ); if( mouseY > 375 ) { fill( 255, 0, 0 ); } else { fill( 255, 255, 255 ); } } void DrawWin() { fill( 0, 0, 0 ); textFont( IMAGE_POOL.m_Fonts[1], 32 ); text( "You Win!", 32, 110 ); fill( 255, 255, 255 ); textFont( IMAGE_POOL.m_Fonts[0], 16 ); text( "Brought to you by:", 30, 255 ); image( IMAGE_POOL.m_Images[10], 45, 265 ); text( "the CBA", 95, 285 ); text( "Created by", 60, 350 ); text( "The CBA Genius", 40, 370 ); } void HandleInput() { switch( m_MenuIndex ) { case 1: m_MenuIndex = 2; break; case 2: ShowInstructions(); break; case 3: SelectDifficulty(); break; case 4: HandleMiss(); break; case 5: HandleDrink(); break; case 6: HandleWin(); break; } } void ShowInstructions() { m_MenuIndex = 3; } void SelectDifficulty() { if( mouseX > 20 && mouseX < 180 ) { if( mouseY > 165 && mouseY < 185 ) { //easy m_MenuIndex = 0; PLAYER.m_Difficulty = 0; } else if( mouseY > 190 && mouseY < 210 ) { //medium m_MenuIndex = 0; PLAYER.m_Difficulty = 1; } else if( mouseY > 215 && mouseY < 235 ) { //hard m_MenuIndex = 0; PLAYER.m_Difficulty = 2; } } } void HandleMiss() { BALL.Reset(); PLAYER.m_Hand.Reset(); m_MenuIndex = 0; } void HandleDrink() { GAME_TABLE.m_Cups[BALL.m_CupIndex].m_Eliminated = true; PLAYER.IncreaseDrunkLevel(); PLAYER.m_Hand.Reset(); BALL.Reset(); m_MenuIndex = 0; GAME_TABLE.CheckForWin(); } void HandleWin() { GAME_TABLE.Reset(); PLAYER.Reset(); MENUS.Reset(); } }