public override string ToString()
{
- return String.Format(
- "{{{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}}}",
- A == ButtonState.Pressed ? "A" : String.Empty,
- B == ButtonState.Pressed ? "B" : String.Empty,
- X == ButtonState.Pressed ? "X" : String.Empty,
- Y == ButtonState.Pressed ? "Y" : String.Empty,
- LeftShoulder == ButtonState.Pressed ? "L" : String.Empty,
- RightShoulder == ButtonState.Pressed ? "R" : String.Empty,
- Back == ButtonState.Pressed ? " Back" : String.Empty,
- Start == ButtonState.Pressed ? " Start" : String.Empty,
- BigButton == ButtonState.Pressed ? " Big" : String.Empty,
- LeftStick == ButtonState.Pressed ? " LStick" : String.Empty,
- RightStick == ButtonState.Pressed ? " RStick" : String.Empty);
+ return Convert.ToString((int)buttons, 2).PadLeft(10, '0');
}
public override int GetHashCode()
public override string ToString()
{
return String.Format(
- "{{Left: {0}; Right: {1}}}",
- Left, Right);
+ "{{Left: ({0:f4}; {1:f4}); Right: ({2:f4}; {3:f4})}}",
+ Left.X, Left.Y, Right.X, Right.Y);
}
public override int GetHashCode()
public override string ToString()
{
return String.Format(
- "{{Left: {0}; Right: {1}}}",
+ "{{Left: {0:f2}; Right: {1:f2}}}",
Left, Right);
}
{
return implementation.GetState(index);
}
+
+ //public string GetName(int index)
+ //{
+ // return implementation.GetName(index);
+ //}
}
}
internal const int MaxAxes = 10;
internal const int MaxButtons = 32;
- const float ConversionFactor = 1.0f / (short.MaxValue + 1);
+ const float ConversionFactor = 1.0f / (short.MaxValue + 0.5f);
unsafe fixed short axes[MaxAxes];
int buttons;
for (int i = 0; i < MaxAxes; i++)
{
sb.Append(" ");
- sb.Append(GetAxis(i));
+ sb.Append(String.Format("{0:f4}", GetAxis(i)));
}
return String.Format(
"{{Axes:{0}; Buttons: {1}; IsConnected: {2}}}",
sb.ToString(),
- Convert.ToString((int)buttons, 2),
+ Convert.ToString((int)buttons, 2).PadLeft(16, '0'),
IsConnected);
}