ProcessEvents() private method

private ProcessEvents ( ) : void
return void
Esempio n. 1
0
        public override void RunLoop()
        {
            ResetWindowBounds();
            while (true)
            {
                _view.ProcessEvents();

                // Stop the main loop iff Game.Exit() has been called.
                // This can happen under the following circumstances:
                // 1. Game.Exit() is called programmatically.
                // 2. The GameWindow is closed through the 'X' (close) button
                // 3. The GameWindow is closed through Alt-F4 or Cmd-Q
                // Note: once Game.Exit() is called, we must stop raising
                // Update or Draw events as the GameWindow and/or OpenGL context
                // may no longer be available.
                // Note 2: Game.Exit() can be called asynchronously from
                // _view.ProcessEvents() (cases #2 and #3 above), so the
                // isExiting check must be placed *after* _view.ProcessEvents()
                if (isExiting > 0)
                {
                    break;
                }

                Game.Tick();
            }
        }
        public override void RunLoop()
        {
            ResetWindowBounds();
            while (true)
            {
                _view.ProcessEvents();

                // Stop the main loop iff Game.Exit() has been called.
                // This can happen under the following circumstances:
                // 1. Game.Exit() is called programmatically.
                // 2. The GameWindow is closed through the 'X' (close) button
                // 3. The GameWindow is closed through Alt-F4 or Cmd-Q
                // Note: once Game.Exit() is called, we must stop raising
                // Update or Draw events as the GameWindow and/or OpenGL context
                // may no longer be available.
                // Note 2: Game.Exit() can be called asynchronously from
                // _view.ProcessEvents() (cases #2 and #3 above), so the
                // isExiting check must be placed *after* _view.ProcessEvents()
                // Note 3: We need to continue processing view events until
                // everything gets disposed of, otherwise it will close the window
                // and make the window handle invalid
                if (isExiting == 0)
                {
                    Game.Tick();
                }
                else if (windowDelay == 2)
                {
                    windowDelay--;
                    Game.ExitEverything();
                }
                else if (windowDelay > 0)
                {
                    windowDelay--;
                }
                else
                {
                    _view.Dispose();
                    break;
                }
            }
        }