/// <summary> /// The setup menu was clicked, perform the button's action. /// </summary> /// <param name="button">the button pressed</param> private static void PerformSetupMenuAction(int button) { switch (button) { case SETUP_MENU_EASY_BUTTON: GameController.SetDifficulty(AIOption.Easy); GameController.setAiDifficultyText("Easy"); break; case SETUP_MENU_MEDIUM_BUTTON: GameController.SetDifficulty(AIOption.Medium); GameController.setAiDifficultyText("Medium"); break; case SETUP_MENU_HARD_BUTTON: GameController.SetDifficulty(AIOption.Medium); GameController.setAiDifficultyText("Hard"); break; } //Always end state - handles exit button as well GameController.EndCurrentState(); }
public static void Main(string[] args) { //Opens a new Graphics Window SwinGame.OpenGraphicsWindow("Battle Ships", 800, 600); //Load Resources GameResources.LoadResources(); SwinGame.PlayMusic(GameResources.GameMusic("Background")); GameController.setAiDifficultyText("Hard"); //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(); }