mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-12 10:55:27 +00:00
Modified GetState() to return the combined state for all mouse/keyboard devices.
This commit is contained in:
parent
5fd0340bb9
commit
415755a257
|
@ -208,6 +208,19 @@ namespace OpenTK.Input
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void MergeBits(KeyboardState other)
|
||||||
|
{
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
int* k2 = other.Keys;
|
||||||
|
fixed (int* k1 = Keys)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < NumInts; i++)
|
||||||
|
*(k1 + i) |= *(k2 + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Members
|
#region Private Members
|
||||||
|
|
|
@ -300,6 +300,23 @@ namespace OpenTK.Input
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void MergeBits(MouseState other)
|
||||||
|
{
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
int* b2 = other.Buttons;
|
||||||
|
fixed (int* b1 = Buttons)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < NumInts; i++)
|
||||||
|
*(b1 + i) |= *(b2 + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
WheelPrecise += other.WheelPrecise;
|
||||||
|
X += other.X;
|
||||||
|
Y += other.Y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Members
|
#region Private Members
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region internal static void UpdateKeyboardList()
|
#region UpdateKeyboardList
|
||||||
|
|
||||||
internal void UpdateKeyboardList()
|
internal void UpdateKeyboardList()
|
||||||
{
|
{
|
||||||
|
@ -264,10 +264,12 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
public KeyboardState GetState()
|
public KeyboardState GetState()
|
||||||
{
|
{
|
||||||
if (keyboards.Count > 0)
|
KeyboardState master = new KeyboardState();
|
||||||
return keyboards[0];
|
foreach (KeyboardState ks in keyboards)
|
||||||
else
|
{
|
||||||
return new KeyboardState();
|
master.MergeBits(ks);
|
||||||
|
}
|
||||||
|
return master;
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyboardState GetState(int index)
|
public KeyboardState GetState(int index)
|
||||||
|
|
|
@ -65,10 +65,12 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
public MouseState GetState()
|
public MouseState GetState()
|
||||||
{
|
{
|
||||||
if (mice.Count > 0)
|
MouseState master = new MouseState();
|
||||||
return mice[0];
|
foreach (MouseState ms in mice)
|
||||||
else
|
{
|
||||||
return new MouseState();
|
master.MergeBits(ms);
|
||||||
|
}
|
||||||
|
return master;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MouseState GetState(int index)
|
public MouseState GetState(int index)
|
||||||
|
|
|
@ -104,10 +104,12 @@ namespace OpenTK.Platform.X11
|
||||||
public MouseState GetState()
|
public MouseState GetState()
|
||||||
{
|
{
|
||||||
ProcessEvents();
|
ProcessEvents();
|
||||||
if (mice.Count > 0)
|
MouseState master = new MouseState();
|
||||||
return mice[0];
|
foreach (MouseState ms in mice)
|
||||||
else
|
{
|
||||||
return new MouseState();
|
master.MergeBits(ms);
|
||||||
|
}
|
||||||
|
return master;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MouseState GetState(int index)
|
public MouseState GetState(int index)
|
||||||
|
|
Loading…
Reference in a new issue