mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-12 11:55:33 +00:00
* Input/KeyboardState.cs: Fixed the amount of storage for keyboard
keys (the code would allocate one less int than necessary when "number of keys % 32" falls between 1 and 15). Fixed the implementation of the Equals method to compare the two instances (instead of comparing this instance against itself).
This commit is contained in:
parent
85c37f0600
commit
ca30b85bad
|
@ -38,13 +38,10 @@ namespace OpenTK.Input
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
const int NumKeys = ((int)Key.LastKey + 16) / 32;
|
// Allocate enough ints to store all keyboard keys
|
||||||
|
const int NumInts = ((int)Key.LastKey + 31) / 32;
|
||||||
// The following line triggers bogus CS0214 in gmcs 2.0.1, sigh...
|
// The following line triggers bogus CS0214 in gmcs 2.0.1, sigh...
|
||||||
unsafe fixed int Keys[NumKeys];
|
unsafe fixed int Keys[NumInts];
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -126,9 +123,9 @@ namespace OpenTK.Input
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
fixed (int* k1 = Keys)
|
fixed (int* k1 = Keys)
|
||||||
fixed (int* k2 = Keys)
|
fixed (int* k2 = other.Keys)
|
||||||
{
|
{
|
||||||
for (int i = 0; equal && i < NumKeys; i++)
|
for (int i = 0; equal && i < NumInts; i++)
|
||||||
equal &= *(k1 + i) == *(k2 + i);
|
equal &= *(k1 + i) == *(k2 + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue