private static ConvertToButtons ( SharpDX buttonFlags, short leftThumbX, short leftThumbY, short rightThumbX, short rightThumbY, byte leftTrigger, byte rightTrigger ) : Microsoft.Xna.Framework.Input.GamePadButtons | ||
buttonFlags | SharpDX | |
leftThumbX | short | |
leftThumbY | short | |
rightThumbX | short | |
rightThumbY | short | |
leftTrigger | byte | |
rightTrigger | byte | |
Результат | Microsoft.Xna.Framework.Input.GamePadButtons |
public static GamePadState GetState(PlayerIndex playerIndex, GamePadDeadZone deadZoneMode = GamePadDeadZone.IndependentAxes) { Controller controller = GamePad.GetController(playerIndex); if (!controller.IsConnected) { return(new GamePadState()); } Gamepad gamepad = controller.GetState().Gamepad; GamePadThumbSticks gamePadThumbSticks1 = new GamePadThumbSticks(GamePad.ConvertThumbStick(gamepad.LeftThumbX, gamepad.LeftThumbY, (short)7849, deadZoneMode), GamePad.ConvertThumbStick(gamepad.RightThumbX, gamepad.RightThumbY, (short)8689, deadZoneMode)); GamePadTriggers gamePadTriggers1 = new GamePadTriggers((float)gamepad.LeftTrigger / (float)byte.MaxValue, (float)gamepad.RightTrigger / (float)byte.MaxValue); GamePadState gamePadState; // ISSUE: explicit reference operation // ISSUE: variable of a reference type GamePadState& local = @gamePadState; GamePadThumbSticks gamePadThumbSticks2 = gamePadThumbSticks1; GamePadTriggers gamePadTriggers2 = gamePadTriggers1; GamePadButtons gamePadButtons = GamePad.ConvertToButtons(gamepad.Buttons, gamepad.LeftThumbX, gamepad.LeftThumbY, gamepad.RightThumbX, gamepad.RightThumbY, gamepad.LeftTrigger, gamepad.RightTrigger); GamePadDPad gamePadDpad = GamePad.ConvertToGamePadDPad(gamepad.Buttons); GamePadThumbSticks thumbSticks = gamePadThumbSticks2; GamePadTriggers triggers = gamePadTriggers2; GamePadButtons buttons = gamePadButtons; GamePadDPad dPad = gamePadDpad;