Exemple #1
0
        //Run the game loop
        public void Run()
        {
            //Update and draw until the game is over
            while (!RL.WindowShouldClose())
            {
                //Change the Scene if needed
                if (_root != _next)
                {
                    _root = _next;
                }

                //Start the Scene if needed
                if (!_root.Started)
                {
                    _root.Start();
                }

                //Update the active Scene
                _root.Update(_gameTimer.GetDeltaTime());

                //Draw the active Scene
                RL.BeginDrawing();
                RL.ClearBackground(Color.BLACK);
                _root.Draw();
                RL.EndDrawing();
            }

            //End the game
            RL.CloseWindow();
        }
Exemple #2
0
 //Default constructor
 public Sprite(string path)
 {
     _image   = RL.LoadImage(path);
     _texture = RL.LoadTextureFromImage(_image);
     X        = -Width / 2;
     Y        = -Height / 2;
 }
Exemple #3
0
 //Draw the Sprite to the screen
 public override void Draw()
 {
     RL.DrawTextureEx(
         _texture,
         new Vector2(XAbsolute, YAbsolute),
         GetRotation() * (float)(180.0f / Math.PI),
         GetScale(),
         Color.WHITE);
     base.Draw();
 }
Exemple #4
0
 //Creates a Game and new Scene instance as its active Scene
 public Game(int width, int height, string title)
 {
     RL.InitWindow(width, height, title);
     RL.SetTargetFPS(0);
 }
Exemple #5
0
 //Returns whether the key is currently up
 public static bool IsKeyUp(int key)
 {
     return(RL.IsKeyUp((KeyboardKey)key));
 }
Exemple #6
0
 //Returns whether the key was release since the last frame
 public static bool IsKeyReleased(int key)
 {
     return(RL.IsKeyReleased((KeyboardKey)key));
 }