예제 #1
0
        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();
            }
        }
예제 #2
0
        public void Update()
        {
            if (ShouldExit())
            {
                _mediaPlayer?.Stop();
                Graphics.Exit();
                return;
            }

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

            _currentTexture = _textureBatch[_frameId];
        }