Beispiel #1
0
        public void Start()
        {
            _running = true;

            if (!Fullscreen)
            {
                PicoPlatform.SetDisplaySize(DisplaySize);
            }
            else
            {
                PicoPlatform.SetDisplayFullscreen(true);
            }

            _gfx.Initialize(PicoPlatform.DisplHandle, DisplaySize.Width, DisplaySize.Height);

            PicoPlatform.ShowDisplay();

            _gameTimer = Stopwatch.StartNew();
            _gameTime  = new GameTime()
            {
                Delta = TimeSpan.Zero, Total = TimeSpan.Zero
            };

            float dt;

            while (_running)
            {
                _gameTime.Delta = _gameTimer.Elapsed - _gameTime.Total;
                _gameTime.Total = _gameTimer.Elapsed;

                PicoPlatform.ProcessEvents();

                _input.UpdateState();

                dt = (float)_gameTime.Delta.TotalSeconds;

                Update(dt);

                if (!_displayModeChanged)
                {
                    _gfx.Begin();

                    Draw(_gfx);

                    _gfx.End();
                }
                else
                {
                    if (_fullscreen)
                    {
                        PicoPlatform.SetDisplayFullscreen(true);
                    }
                    else
                    {
                        PicoPlatform.SetDisplayFullscreen(false);
                        PicoPlatform.SetDisplaySize(_requestedDisplaySize);
                    }

                    _displayModeChanged = false;
                }

                if (_titleChanged)
                {
                    PicoPlatform.SetTitle(_title);
                    _titleChanged = false;
                }
            }
        }