public void Run() { Init(); //Loop until game is over while (!gameOver && !RL.WindowShouldClose()) { if (_currentScene != _nextScene) { _currentScene = _nextScene; } _currentScene.Update(_gameTimer.GetDeltaTime()); if (!_currentScene.Started) { _currentScene.Start(); } RL.BeginDrawing(); RL.ClearBackground(Color.RED); _currentScene.Draw(); RL.EndDrawing(); } RL.CloseWindow(); }
public void Run() { Player player = new Player(); player.X = 4; player.Y = 0; Entity enemy = new Entity('#'); enemy.X = 7; enemy.Y = 2; _currentScene.AddEntity(player); _currentScene.AddEntity(enemy); _currentScene.Start(); //loops until the game is over while (!GameOver) { _currentScene.Update(); _currentScene.Draw(); PlayerInput.ReadKey(); } }
public void Run() { Init(); // PlayerInput.AddKeyEvent(Quit, ConsoleKey.Escape); (no longer needed) //Loop until the game is over while (!Gameover && !RL.WindowShouldClose()) { //Start the Scene if needed if (_currentScene != _nextScene) { _currentScene = _nextScene; } _currentScene.Update(_gameTimer.GetDeltaTime()); if (!_currentScene.Started) { _currentScene.Start(); } //update the active Scene /* int mouseX = (RL.GetMouseX() + 320) / 2; * int mouseY = (RL.GetMouseY() - 240) / 4; * * Raylib.Vector3 cameraPosition = new Raylib.Vector3(-10, -10, -10); * Raylib.Vector3 cameraTarget = new Raylib.Vector3(mouseX, 0, mouseY); * Raylib.Vector3 cameraUp = new Raylib.Vector3(1, 1, 1); * * * * _ * _camera = new Camera3D(cameraPosition, cameraTarget, cameraUp); */ Camera2D _camera = new Camera2D(); //_camera.target = new Raylib.Vector2(-5, 0); _camera.zoom = 3; RL.BeginDrawing(); RL.BeginMode2D(_camera); _currentScene.Draw(); RL.EndMode2D(); RL.EndDrawing(); } }