예제 #1
0
        public static GamePadState GetState(PlayerIndex playerIndex, GamePadDeadZone deadZone)
        {
            GamePadState.RawState state;
            uint result = Imports.XInputGamePadGetState((uint)playerIndex, out state);

            return(new GamePadState(result == Utils.Success, state, deadZone));
        }
예제 #2
0
		public static GamePadState GetState( PlayerIndex playerIndex, GamePadDeadZone deadZone )
		{
			IntPtr gamePadStatePointer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(GamePadState.RawState)));
			uint result = Imports.XInputGamePadGetState((uint)playerIndex, gamePadStatePointer);
			GamePadState.RawState state = (GamePadState.RawState)Marshal.PtrToStructure(gamePadStatePointer, typeof(GamePadState.RawState));
			return new GamePadState(result == Utils.Success, state, deadZone);
		}
예제 #3
0
        public static GamePadState GetState(PlayerIndex playerIndex)
        {
            IntPtr intPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(GamePadState.RawState)));
            uint   num    = Imports.XInputGamePadGetState((uint)playerIndex, intPtr);

            GamePadState.RawState rawState = (GamePadState.RawState)Marshal.PtrToStructure(intPtr, typeof(GamePadState.RawState));
            return(new GamePadState(num == 0, rawState));
        }
예제 #4
0
        public static GamePadState GetState(PlayerIndex playerIndex)
        {
            var gamePadStatePointer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(GamePadState.RawState)));
            var result = Imports.XInputGamePadGetState((uint)playerIndex, gamePadStatePointer);
            var state  = (GamePadState.RawState)Marshal.PtrToStructure(gamePadStatePointer, typeof(GamePadState.RawState));

            return(new GamePadState(result == 0, state));
        }
예제 #5
0
 public static GamePadState GetState(PlayerIndex playerIndex, GamePadDeadZone deadZone)
 {
     InitDistanceLoader();
     return(new GamePadState(Imports.XInputGamePadGetState((uint)playerIndex, out var state) == 0U, state, deadZone));
 }