Exemple #1
0
        public void Update(GameTime gameTime)
        {
            var state   = GamePad.GetState(PlayerIndex.One);
            var kbState = Keyboard.GetState();

            Game.Tooltip = "";

            if (!Stopped && !Paused)
            {
                GameScreen.Update(gameTime);
            }

            if (kbState.IsKeyDown(Keys.Escape) && oldState.IsKeyUp(Keys.Escape))
            {
                Paused = !Paused;
            }

            if (oldState.IsKeyUp(Keys.OemTilde) && kbState.IsKeyDown(Keys.OemTilde))
            {
                Console.ToggleOpenClose();
                Stopped = !Stopped;
            }

            if (state.IsConnected)
            {
                ControllerCursorPos.X += state.ThumbSticks.Right.X * 5;
                ControllerCursorPos.Y += -state.ThumbSticks.Right.Y * 5;
            }
            oldState = kbState;
        }
Exemple #2
0
        private void LoopUpdate()
        {
            // get delta
            var delta = _updateDelta.GetDelta();

            // update screen
            GameScreen.Update(delta);
        }
Exemple #3
0
        protected override void Update(GameTime gameTime)
        {
            if (screen != null)
            {
                screen.Update(spriteBatch, gameTime);
            }

            base.Update(gameTime);
        }
        protected override void Update(GameTime gameTime)
        {
            if (_nextScene != null)
            {
                TransitionScene();
            }

            _activeScene?.Update(gameTime);

            base.Update(gameTime);
        }
Exemple #5
0
        protected override void Update(GameTime gameTime)
        {
            lastTime = gameTime;
            if (screen != null)
            {
                switch (screen.State)
                {
                case ScreenState.Running:
                    screen.Update(gameTime);
                    break;

                case ScreenState.ChangeNext:
                    screen.OnExit(gameTime);
                    screen = screenList.Next;
                    if (screen != null)
                    {
                        screen.SetRunning();
                        screen.OnEntry(gameTime);
                    }
                    break;

                case ScreenState.ChangePrevious:
                    screen.OnExit(gameTime);
                    screen = screenList.Previous;
                    if (screen != null)
                    {
                        screen.SetRunning();
                        screen.OnEntry(gameTime);
                    }
                    break;

                case ScreenState.ExitApplication:
                    Exit();
                    return;
                }
                base.Update(gameTime);
            }
            else
            {
                Exit();
            }
        }
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="time">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime time)
        {
            if (GraphicsDevice.PresentationParameters.BackBufferWidth != 1024 ||
                GraphicsDevice.PresentationParameters.BackBufferHeight != 640)
            {
                graphics.PreferredBackBufferWidth  = 1024;
                graphics.PreferredBackBufferHeight = 640;
                graphics.ApplyChanges();
            }
            updateFps.Enqueue((float)(1000.0 / time.ElapsedGameTime.TotalMilliseconds));
            if (updateFps.Count > 300)
            {
                updateFps.Dequeue();
            }

            MouseHelper.Update();
            KeyboardHelper.Update();
            screen?.Update(time);
            base.Update(time);
        }
Exemple #7
0
 public override void Update(GameTime gameTime)
 {
     _activeScreen?.Update(gameTime);
     _activeTransition?.Update(gameTime);
 }