public void Run() { app.SetMouseCursorVisible(false); SetMousePointerInTheMiddleOfTheScreen(); // Start the game loop while (app.IsOpen) { // Process events app.DispatchEvents(); if (!Pause) { SetMousePointerInTheMiddleOfTheScreen(); } game.Action(); DrawBackground(app); DrawBorders(app); DrawBricks(app); DrawPad(app); DrawBall(app); DrawTexts(app); // Update the window app.Display(); } font?.Dispose(); background?.Dispose(); }
/// <summary> /// Обрабатывает нажатие клавиши на клавиатуре /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnKeyDown(object sender, KeyEventArgs e) { if (gameState != State.Running) { return; } if (ControlActions.StopTime == GUI.Controls.ControlFromKey(e.KeyCode)) { Pause(); } else { _game.Action( $"key_down {GUI.Controls.ControlFromKey(e.KeyCode)}"); //.Add(GUI.Controls.ControlFromKey(e.KeyCode)); } }
public void WinCondTests(string a1, string a3, string a2) { (game as GameXO).SetTest(); game.Action("1", a1); game.Action("1", a2); game.Action("1", a3); Assert.AreEqual(GameState.EndWithWinner, game.CurrentState); Assert.AreEqual("1", game.Winner); }