mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-24 18:05:34 +00:00
Improved ToString implementation
This commit is contained in:
parent
3c6298a1e6
commit
0a71bbe065
|
@ -109,19 +109,7 @@ namespace OpenTK.Input
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return String.Format(
|
return Convert.ToString((int)buttons, 2).PadLeft(10, '0');
|
||||||
"{{{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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
|
|
|
@ -73,8 +73,8 @@ namespace OpenTK.Input
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return String.Format(
|
return String.Format(
|
||||||
"{{Left: {0}; Right: {1}}}",
|
"{{Left: ({0:f4}; {1:f4}); Right: ({2:f4}; {3:f4})}}",
|
||||||
Left, Right);
|
Left.X, Left.Y, Right.X, Right.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace OpenTK.Input
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return String.Format(
|
return String.Format(
|
||||||
"{{Left: {0}; Right: {1}}}",
|
"{{Left: {0:f2}; Right: {1:f2}}}",
|
||||||
Left, Right);
|
Left, Right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,5 +47,10 @@ namespace OpenTK.Input
|
||||||
{
|
{
|
||||||
return implementation.GetState(index);
|
return implementation.GetState(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//public string GetName(int index)
|
||||||
|
//{
|
||||||
|
// return implementation.GetName(index);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace OpenTK.Input
|
||||||
internal const int MaxAxes = 10;
|
internal const int MaxAxes = 10;
|
||||||
internal const int MaxButtons = 32;
|
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];
|
unsafe fixed short axes[MaxAxes];
|
||||||
int buttons;
|
int buttons;
|
||||||
|
@ -94,12 +94,12 @@ namespace OpenTK.Input
|
||||||
for (int i = 0; i < MaxAxes; i++)
|
for (int i = 0; i < MaxAxes; i++)
|
||||||
{
|
{
|
||||||
sb.Append(" ");
|
sb.Append(" ");
|
||||||
sb.Append(GetAxis(i));
|
sb.Append(String.Format("{0:f4}", GetAxis(i)));
|
||||||
}
|
}
|
||||||
return String.Format(
|
return String.Format(
|
||||||
"{{Axes:{0}; Buttons: {1}; IsConnected: {2}}}",
|
"{{Axes:{0}; Buttons: {1}; IsConnected: {2}}}",
|
||||||
sb.ToString(),
|
sb.ToString(),
|
||||||
Convert.ToString((int)buttons, 2),
|
Convert.ToString((int)buttons, 2).PadLeft(16, '0'),
|
||||||
IsConnected);
|
IsConnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue