コード例 #1
0
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            InputManager.Update();
            Time.Update(gameTime);

            GameObject2d.UpdateObjects();

            // Just to prove I can
            //map.Layers.First().Value.Opacity = (float)(Math.Cos(Math.PI * (gameTime.TotalGameTime.Milliseconds * 4) / 10000));

            if (InputManager.IsKeyDown(Keys.Up))
            {
                b.X += 0.01f; b.Y += 0.01f;
            }
            if (InputManager.IsKeyDown(Keys.Down) && b.Length() > 0)
            {
                b.X -= 0.01f; b.Y -= 0.01f;
            }

            base.Update(gameTime);
        }
コード例 #2
0
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            InputManager.Update();
            Time.Update(gameTime);

            GameObject2d.UpdateObjects();

            // Testing screen stuff
            if (InputManager.IsKeyDown(Keys.Up))
            {
                b.X += 0.01f; b.Y += 0.01f;
            }
            if (InputManager.IsKeyDown(Keys.Down) && b.Length() > 0)
            {
                b.X -= 0.01f; b.Y -= 0.01f;
            }
            if (InputManager.IsKeyPressed(Keys.F))
            {
                (ScreenManager.Game as Main).graphics.ToggleFullScreen();
            }
        }