private void GameLoop()
        {
            var gameTime = new GameTime();
            var watch    = new Stopwatch();

            try
            {
                while (Graphics.IsRunning)
                {
                    var scene = SceneManager.GetCurrentScene();
                    scene.Update();
                    gameTime.Update(watch.Elapsed);
                    watch.Restart();
                    scene.Render(gameTime);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                watch.Stop();
                Graphics.Exit();
                _appLifeTime.StopApplication();
            }
        }
Esempio n. 2
0
        public void Update()
        {
            if (ShouldExit())
            {
                _mediaPlayer?.Stop();
                Graphics.Exit();
                return;
            }

            _frameId++;
            if (_frameId >= _textureBatch.Count)
            {
                _frameId = 0;
            }

            _currentTexture = _textureBatch[_frameId];
        }