Exemplo n.º 1
0
        public void Run(GameRunBehavior runBehavior)
        {
            this.AssertNotDisposed();
            if (!this.Platform.BeforeRun())
            {
                return;
            }
            if (!this._initialized)
            {
                this.DoInitialize();
                this._initialized = true;
            }
            this.BeginRun();
            switch (runBehavior)
            {
            case GameRunBehavior.Asynchronous:
                this.Platform.AsyncRunLoopEnded += new EventHandler <EventArgs>(this.Platform_AsyncRunLoopEnded);
                this.Platform.StartRunLoop();
                break;

            case GameRunBehavior.Synchronous:
                this.Platform.RunLoop();
                this.EndRun();
                this.DoExiting();
                break;

            default:
                throw new NotImplementedException(string.Format("Handling for the run behavior {0} is not implemented.", (object)runBehavior));
            }
        }
Exemplo n.º 2
0
        public void Run(GameRunBehavior runBehavior)
        {
            AssertNotDisposed();
            if (!Platform.BeforeRun())
            {
                return;
            }

            if (!_initialized)
            {
                DoInitialize();
                _initialized = true;
            }

            BeginRun();
            switch (runBehavior)
            {
            case GameRunBehavior.Asynchronous:
                Platform.AsyncRunLoopEnded += Platform_AsyncRunLoopEnded;
                Platform.StartRunLoop();
                break;

            case GameRunBehavior.Synchronous:
                Platform.RunLoop();
                EndRun();
                DoExiting();
                break;

            default:
                throw new ArgumentException(string.Format(
                                                "Handling for the run behavior {0} is not implemented.", runBehavior));
            }
        }
Exemplo n.º 3
0
        public void Run(GameRunBehavior runBehavior)
        {
            AssertNotDisposed();
            if (!Platform.BeforeRun())
            {
                return;
            }

            // In an original XNA game the GraphicsDevice property is null
            // during initialization but before the Game's Initialize method is
            // called the property is available so we can only assume that it
            // should be created somewhere in here.  We cannot set the viewport
            // values correctly based on the Preferred settings which is causing
            // some problems on some Microsoft samples which we are not handling
            // correctly.
            graphicsDeviceManager.CreateDevice();
            applyChanges(graphicsDeviceManager);

            Platform.BeforeInitialize();
            Initialize();
            _initialized = true;

            BeginRun();
            switch (runBehavior)
            {
            case GameRunBehavior.Asynchronous:
                Platform.AsyncRunLoopEnded += Platform_AsyncRunLoopEnded;
                Platform.StartRunLoop();
                break;

            case GameRunBehavior.Synchronous:
                Platform.RunLoop();
                EndRun();
                OnExiting(this, EventArgs.Empty);
                break;

            default:
                throw new NotImplementedException(string.Format(
                                                      "Handling for the run behavior {0} is not implemented.", runBehavior));
            }
        }
Exemplo n.º 4
0
        public void Run(GameRunBehavior runBehavior)
        {
            AssertNotDisposed();
            if (!Platform.BeforeRun())
            {
                BeginRun();
                _gameTimer = Stopwatch.StartNew();
                return;
            }

            if (!_initialized)
            {
                DoInitialize();
                _initialized = true;
            }

            BeginRun();
            _gameTimer = Stopwatch.StartNew();
            switch (runBehavior)
            {
            case GameRunBehavior.Asynchronous:
                Platform.AsyncRunLoopEnded += Platform_AsyncRunLoopEnded;
                Platform.StartRunLoop();
                break;

            case GameRunBehavior.Synchronous:
                // XNA runs one Update even before showing the window
                DoUpdate(new GameTime());

                Platform.RunLoop();
                EndRun();
                DoExiting();
                break;

            default:
                throw new ArgumentException(string.Format(
                                                "Handling for the run behavior {0} is not implemented.", runBehavior));
            }
        }
Exemplo n.º 5
0
 public void Run(GameRunBehavior runBehavior)
 {
 }