From 1ccf7e5ad22d7d0f7e67575e0f65945e49758b48 Mon Sep 17 00:00:00 2001 From: thefiddler Date: Thu, 2 Jan 2014 19:24:15 +0100 Subject: [PATCH] [Input] Added PacketNumber property --- Source/OpenTK/Input/GamePadState.cs | 11 +++++++++++ Source/OpenTK/Input/JoystickState.cs | 11 +++++++++++ Source/OpenTK/Platform/MappedGamePadDriver.cs | 2 ++ 3 files changed, 24 insertions(+) diff --git a/Source/OpenTK/Input/GamePadState.cs b/Source/OpenTK/Input/GamePadState.cs index 179762b3..60318dae 100644 --- a/Source/OpenTK/Input/GamePadState.cs +++ b/Source/OpenTK/Input/GamePadState.cs @@ -37,6 +37,7 @@ namespace OpenTK.Input const float RangeMultiplier = 1.0f / (short.MaxValue + 1); Buttons buttons; + int packet_number; short left_stick_x; short left_stick_y; short right_stick_x; @@ -72,6 +73,11 @@ namespace OpenTK.Input get { return is_connected; } } + public int PacketNumber + { + get { return packet_number; } + } + public override string ToString() { return String.Format( @@ -167,6 +173,11 @@ namespace OpenTK.Input right_trigger = right; } + internal void SetPacketNumber(int number) + { + packet_number = number; + } + #endregion #region Private Members diff --git a/Source/OpenTK/Input/JoystickState.cs b/Source/OpenTK/Input/JoystickState.cs index 7f1624d8..e8e2abf2 100644 --- a/Source/OpenTK/Input/JoystickState.cs +++ b/Source/OpenTK/Input/JoystickState.cs @@ -45,6 +45,7 @@ namespace OpenTK.Input unsafe fixed short axes[MaxAxes]; int buttons; + int packet_number; bool is_connected; #region Public Members @@ -79,6 +80,11 @@ namespace OpenTK.Input get { return is_connected; } } + internal int PacketNumber + { + get { return packet_number; } + } + public override string ToString() { StringBuilder sb = new StringBuilder(); @@ -167,6 +173,11 @@ namespace OpenTK.Input is_connected = value; } + internal void SetPacketNumber(int number) + { + packet_number = number; + } + #endregion #region Private Members diff --git a/Source/OpenTK/Platform/MappedGamePadDriver.cs b/Source/OpenTK/Platform/MappedGamePadDriver.cs index afe839c4..20da30a8 100644 --- a/Source/OpenTK/Platform/MappedGamePadDriver.cs +++ b/Source/OpenTK/Platform/MappedGamePadDriver.cs @@ -65,6 +65,8 @@ namespace OpenTK.Platform if (joy.IsConnected) { pad.SetConnected(true); + pad.SetPacketNumber(joy.PacketNumber); + GamePadConfiguration configuration = GetConfiguration(Joystick.GetGuid(index)); foreach (GamePadConfigurationItem map in configuration)