Exemplo n.º 1
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            TouchCollection touchCollection = TouchPanel.GetState();

            foreach (TouchLocation touchLocation in touchCollection)
            {
                if (TouchLocationState.Pressed == touchLocation.State)
                {
                    if (imeHandler.Enabled)
                    {
                        imeHandler.StopTextComposition();
                    }
                    else
                    {
                        imeHandler.StartTextComposition();
                    }
                }
            }

            base.Update(gameTime);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <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();
            }

            KeyboardState ks = Keyboard.GetState();

            if (ks.IsKeyDown(Keys.F1) && !F1Pressed)
            {
                F1Pressed = true;
                if (imeHandler.Enabled)
                {
                    imeHandler.StopTextComposition();
                }
                else
                {
                    imeHandler.StartTextComposition();
                }
            }
            if (ks.IsKeyUp(Keys.F1) && F1Pressed)
            {
                F1Pressed = false;
            }

            base.Update(gameTime);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // For Mobile devices, this logic will close the Game when the Back button is pressed.
            // Exit() is obsolete on iOS
#if !__IOS__ && !__TVOS__
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
                Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }
#endif

            TouchCollection touchCollection = TouchPanel.GetState();
            foreach (TouchLocation touchLocation in touchCollection)
            {
                if (TouchLocationState.Pressed == touchLocation.State)
                {
                    if (imeHandler.Enabled)
                    {
                        imeHandler.StopTextComposition();
                    }
                    else
                    {
                        imeHandler.StartTextComposition();
                    }
                }
            }

            //imeHandler.Update(gameTime);

            base.Update(gameTime);
        }