Update() public method

public Update ( Microsoft.Xna.Framework.Input.Touch.TouchLocation touchLocation ) : void
touchLocation Microsoft.Xna.Framework.Input.Touch.TouchLocation
return void
Ejemplo n.º 1
0
        private GamePadState HandleVirtualStickWP7()
        {
            List <Buttons> buttons = new List <Buttons>();
            Vector2        stick   = Vector2.Zero;

#if WINDOWS_PHONE
            _phoneA.Pressed = false;
            _phoneB.Pressed = false;
            TouchCollection touchLocations = TouchPanel.GetState();
            foreach (TouchLocation touchLocation in touchLocations)
            {
                _phoneA.Update(touchLocation);
                _phoneB.Update(touchLocation);
                _phoneStick.Update(touchLocation);
            }
            if (_phoneA.Pressed)
            {
                buttons.Add(Buttons.A);
            }
            if (_phoneB.Pressed)
            {
                buttons.Add(Buttons.B);
            }
            stick = _phoneStick.StickPosition;
#endif
            return(new GamePadState(stick, Vector2.Zero, 0f, 0f, buttons.ToArray()));
        }