Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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();
            }
        }
Esempio n. 3
0
        public void Run()
        {
            Init();
            //PlayerInput.AddKeyEvent(Quit, ConsoleKey.Escape);

            while (!gameOver && !RL.WindowShouldClose())
            {
                _currentscene.Update();

                int mouseX = (RL.GetMouseX() - 320 / 16);
                int mouseY = (RL.GetMouseY() - 240 / 32);
                //Raylib.Vector3 cameraPosition = new Raylib.Vector3(-10, -10, -10);
                //Raylib.Vector3 cameraTarget = new Raylib.Vector3(mouseX, 0, mouseY);
                //Raylib.Vector3 cameraUp = new Raylib.Vector3(0, 0, 1);

                //_camera = new Camera3D(cameraPosition, cameraTarget, cameraUp);

                RL.BeginDrawing();
                //RL.BeginMode3D(_camera);
                _currentscene.Draw();
                //RL.EndMode3D();
                RL.EndDrawing();

                PlayerInput.ReadKey();
            }
            RL.CloseWindow();
        }
Esempio n. 4
0
        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();
            }
        }
Esempio n. 5
0
        public void Run()
        {
            //Bind Esc to exit the game (no longer needed)
            //PlayerInput.AddKeyEvent(Quit, ConsoleKey.Escape);

            Init();

            //Update, draw, and get input until the game is over
            while (!Gameover && !RL.WindowShouldClose())
            {
                _currentScene.Update();
                RL.BeginDrawing();

                _currentScene.Draw();
                RL.EndDrawing();
                PlayerInput.ReadKey();
            }
            RL.WindowShouldClose();
        }
Esempio n. 6
0
 //--------------------------------------------------------------------------------
 //	描画
 //--------------------------------------------------------------------------------
 virtual public void Draw( )
 {
     //	シーンがnullでなければシーンのDrawを実行
     if (m_scene_current != null)
     {
         m_scene_current.Draw( );
     }
     if (___bDEBUG___ == true)
     {
         m_nFPS_counter++;
         if (DX.GetNowCount( ) >= m_nFPS_prev_time + 1000)
         {
             m_nFPS_prev_time = DX.GetNowCount( );
             m_nFPS_prev      = m_nFPS_counter;
             m_szFPS          = m_nFPS_counter + " fps";
             m_nFPS_counter   = 0;
         }
         DX.DrawString(0, 580, m_szFPS, COLOR_WHITE);
     }
 }