Esempio n. 1
0
 public void GameLoop()
 {
     while (win.IsRunning())
     {
         gameTimer.MeasureTime();
         while (gameTimer.ShouldUpdate())
         {
             eventBus.ProcessEvents();
             win.PollEvents();
         }
         if (gameTimer.ShouldRender())
         {
             win.Clear();
             player.Entity.RenderEntity();
             score.RenderScore();
             player.Move();
             foreach (var enemy in enemies)
             {
                 enemy.Entity.RenderEntity();
             }
             PlayerShot.iterateShots();
             foreach (var shot in PlayerShots)
             {
                 shot.Entity.RenderEntity();
             }
             newEnemies();
             PlayerShots = PlayerShot.updateShot();
             win.SwapBuffers();
         }
         if (gameTimer.ShouldReset())
         {
             win.Title = "galga | UPS" + gameTimer.CapturedUpdates +
                         ", FPS " + gameTimer.CapturedUpdates;
         }
     }
 }