[Input] JoystickState.ToString now prints hat pos

This commit is contained in:
thefiddler 2014-03-17 00:29:45 +01:00
parent 05bbc0b3f4
commit 01c3b51be6

View file

@ -145,9 +145,10 @@ namespace OpenTK.Input
sb.Append(String.Format("{0:f4}", GetAxis(JoystickAxis.Axis0 + i))); sb.Append(String.Format("{0:f4}", GetAxis(JoystickAxis.Axis0 + i)));
} }
return String.Format( return String.Format(
"{{Axes:{0}; Buttons: {1}; IsConnected: {2}}}", "{{Axes:{0}; Buttons: {1}; Hat: {2}; IsConnected: {3}}}",
sb.ToString(), sb.ToString(),
Convert.ToString((int)buttons, 2).PadLeft(16, '0'), Convert.ToString((int)buttons, 2).PadLeft(16, '0'),
hat0,
IsConnected); IsConnected);
} }
@ -303,6 +304,11 @@ namespace OpenTK.Input
{ {
equals &= GetAxisUnsafe(i) == other.GetAxisUnsafe(i); equals &= GetAxisUnsafe(i) == other.GetAxisUnsafe(i);
} }
for (int i = 0; equals && i < MaxHats; i++)
{
JoystickHat hat = JoystickHat.Hat0 + i;
equals &= GetHat(hat).Equals(other.GetHat(hat));
}
return equals; return equals;
} }