Example #1
0
        protected override void Update(GameTime gameTime)
        {
            var st = Keyboard.GetState();

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                Exit();
            }
            if (!loading)
            {
                long now = FileSystemTime.Now1;
                if (fsTime != -1)
                {
                    //limit frame to 100ms
                    ts.Update(Math.Min(100 * 1000, (now - fsTime) / 10.0));
                }
                fsTime = now;

                inp.Update(st);


                if (st.IsKeyDown(Keys.Escape))
                {
                    if (g.Playing)
                    {
                        g.Pause();
                    }
                    else
                    {
                        g.Play();
                    }
                }
            }
            base.Update(gameTime);
        }
Example #2
0
        public void Update(GameTime gameTime)
        {
            var  st  = Keyboard.GetState();
            long now = FileSystemTime.Now1;

            if (fsTime != -1)
            {
                //limit frame to 100ms
                ts.Update(Math.Min(100 * 1000, (now - fsTime) / 10.0));
            }
            fsTime = now;

            inp.Update(st);


            if (globals.InputManager.DidPress(Keys.Escape))
            {
                if (g.Playing)
                {
                    g.Pause();
                }
                else
                {
                    g.Play();
                }
            }
            else if (globals.InputManager.DidPress(Keys.OemTilde))
            {
                //TODO think more about this screen switching logic
                globals.ScreenManager.Switch(previous);
            }
        }