public void Run() { Init(); SoundEngine.Init(); TextureEngine.LoadImages(); TextureEngine.Init(); // Главный цикл программы while (window.IsOpen) { // Вызов обработчиков событий window.DispatchEvents(); window.Clear(clearColor); if (isPaused) { gameTimer.Stop(); DrawPause(); } else if (isGameOver) { gameTimer.Stop(); DrawGameOver(); } else if (!isPaused && !isGameOver) { Update(window, dt); } window.Display(); } }
private void Window_KeyPressed(object sender, KeyEventArgs e) { if ((e.Code == Keyboard.Key.Escape)) { if (!isPaused && !isGameOver) { isPaused = true; } else if (isPaused) { isPaused = false; gameTimer.Start(); } } if ((e.Code == Keyboard.Key.Return)) { if (isGameOver) { isGameOver = false; gameTimer.Start(); } } if ((e.Code == Keyboard.Key.Tab)) { if (!useTextures) { useTextures = true; TextureEngine.Init(); } else if (useTextures) { useTextures = false; } } }