/// <summary> /// Handles input during the discovery phase of the game. /// </summary> /// <remarks> /// Escape opens the game menu. Clicking the mouse will /// attack a location. /// </remarks> public static void HandleDiscoveryInput() { if (SwinGame.KeyTyped(KeyCode.vk_ESCAPE)) { GameController.AddNewState(GameState.ViewingGameMenu); } //Cheat to end of game if (SwinGame.KeyTyped(KeyCode.vk_c)) { GameController.SwitchState(GameState.EndingGame); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { DoAttack(); } const int BX = 693; const int BY = 72; const int BWIDTH = 78; const int BHEIGHT = 44; Rectangle R = SwinGame.RectangleFrom(BX, BY, BWIDTH, BHEIGHT); if (SwinGame.MouseClicked(MouseButton.LeftButton)) { Point2D mPoint = SwinGame.MousePosition(); if (SwinGame.PointInRect(mPoint, R)) { GameController.EndCurrentState(); } } }
/// <summary> /// Handles the user input during the top score screen. /// </summary> /// <remarks></remarks> public static void HandleHighScoreInput() { const int BX = 2 * SCORES_LEFT / 3; const int BY = 80 + 12 * 30; const int BWIDTH = 166; const int BHEIGHT = 58; Rectangle R = SwinGame.RectangleFrom(BX, BY, BWIDTH, BHEIGHT); if (SwinGame.MouseClicked(MouseButton.LeftButton)) { Point2D mPoint = SwinGame.MousePosition(); if (SwinGame.PointInRect(mPoint, R)) { GameController.SwitchState(GameState.ViewingMainMenu); } } // if (SwinGame.MouseClicked(MouseButton.LeftButton) || SwinGame.KeyTyped(KeyCode.vk_ESCAPE) || SwinGame.KeyTyped(KeyCode.vk_RETURN)) { // GameController.EndCurrentState(); // } }
/// <summary> /// Handles the processing of user input when the Hotkeys menu is showing /// </summary> public static void HandleHotkeysMenuInput() { if (SwinGame.KeyTyped(UtilityFunctions.EscapeKey)) { GameController.SwitchState(GameState.ViewingGameMenu); } if (SwinGame.AnyKeyPressed()) { // Escape key if (SwinGame.PointInRect(SwinGame.MousePosition(), SwinGame.ScreenWidth() - HOTKEYS_BIND, 100, 50, 25)) { UtilityFunctions.EscapeKey = UtilityFunctions.KeyTyped(UtilityFunctions.EscapeKey); } // Up key if (SwinGame.PointInRect(SwinGame.MousePosition(), SwinGame.ScreenWidth() - HOTKEYS_BIND, 150, 50, 25)) { UtilityFunctions.UpKey = UtilityFunctions.KeyTyped(UtilityFunctions.UpKey); } // Down key if (SwinGame.PointInRect(SwinGame.MousePosition(), SwinGame.ScreenWidth() - HOTKEYS_BIND, 200, 50, 25)) { UtilityFunctions.DownKey = UtilityFunctions.KeyTyped(UtilityFunctions.DownKey); } // Left key if (SwinGame.PointInRect(SwinGame.MousePosition(), SwinGame.ScreenWidth() - HOTKEYS_BIND, 250, 50, 25)) { UtilityFunctions.LeftKey = UtilityFunctions.KeyTyped(UtilityFunctions.LeftKey); } // Random key if (SwinGame.PointInRect(SwinGame.MousePosition(), SwinGame.ScreenWidth() - HOTKEYS_BIND, 300, 50, 25)) { UtilityFunctions.RandomKey = UtilityFunctions.KeyTyped(UtilityFunctions.RandomKey); } // Blue key if (SwinGame.PointInRect(SwinGame.MousePosition(), SwinGame.ScreenWidth() - HOTKEYS_BIND, 350, 50, 25)) { UtilityFunctions.BlueKey = UtilityFunctions.KeyTyped(UtilityFunctions.BlueKey); } // Pink key if (SwinGame.PointInRect(SwinGame.MousePosition(), SwinGame.ScreenWidth() - HOTKEYS_BIND, 400, 50, 25)) { UtilityFunctions.PinkKey = UtilityFunctions.KeyTyped(UtilityFunctions.PinkKey); } // Cheats key if (SwinGame.PointInRect(SwinGame.MousePosition(), SwinGame.ScreenWidth() - HOTKEYS_BIND, 450, 50, 25)) { UtilityFunctions.CheatsKey = UtilityFunctions.KeyTyped(UtilityFunctions.CheatsKey); } // Maximise screen key if (SwinGame.PointInRect(SwinGame.MousePosition(), SwinGame.ScreenWidth() - HOTKEYS_BIND, 450, 50, 25)) { UtilityFunctions.MaxKey = UtilityFunctions.KeyTyped(UtilityFunctions.MaxKey); } } }