/// <summary> /// The main menu was clicked, perform the button's action. /// </summary> /// <param name="button">the button pressed</param> private static void PerformMainMenuAction(int button) { switch (button) { case MAIN_MENU_PLAY_BUTTON: { GameController.StartGame(); break; } case MAIN_MENU_SETUP_BUTTON: { GameController.AddNewState(GameState.AlteringSettings); break; } case MAIN_MENU_TOP_SCORES_BUTTON: { GameController.AddNewState(GameState.ViewingHighScores); break; } //mute extension case MAIN_MENU_MUTE_BTTON: { switch (Variables._isMute) { case true: Variables._isMute = false; SwinGame.PlayMusic(GameResources.GameMusic("Background")); break; case false: Variables._isMute = true; SwinGame.StopMusic(); break; } break; } case MAIN_MENU_QUIT_BUTTON: { GameController.EndCurrentState(); break; } } }
public static void Main() { // Opens a new Graphics Window SwinGame.OpenGraphicsWindow("Battle Ships", 800, 600); // Load Resources GameResources.LoadResources(); SwinGame.PlayMusic(GameResources.GameMusic("Background")); // Game Loop do { GameController.HandleUserInput(); GameController.DrawScreen(); }while (!(SwinGame.WindowCloseRequested() == true | GameController.CurrentState == GameState.Quitting)); SwinGame.StopMusic(); // Free Resources and Close Audio, to end the program. GameResources.FreeResources(); }