[Win] Improve WinMM.GetCapabilities performance

Polling joyGetCaps is very very slow, so we should not do that every
time GetCapabilities is called. Instead, we should call joyGetCaps once
and cache the results.

We need to find a different way to implement hotplugging.
This commit is contained in:
Stefanos A 2014-01-16 23:35:31 +01:00 committed by thefiddler
parent c3b289ee9b
commit 9cf3deea8c
3 changed files with 12 additions and 0 deletions

View file

@ -101,6 +101,8 @@ namespace Examples
public static void Main(string[] args)
{
Trace.Listeners.Add(new ConsoleTraceListener());
Tests.GameWindowStates.Main();
return;
if (args.Length > 0)
{

View file

@ -50,6 +50,9 @@ namespace OpenTK.Platform.Windows
readonly XInputJoystick xinput;
readonly WinMMJoystick winmm;
readonly Dictionary<int, int> index_to_winmm =
new Dictionary<int, int>();
#region Constructors
public WinCombinedJoystick(XInputJoystick xinput, WinMMJoystick winmm)

View file

@ -82,6 +82,13 @@ namespace OpenTK.Platform.Windows
const ClassStyle DefaultClassStyle = ClassStyle.OwnDC;
// Used for IInputDriver implementation
LegacyJoystickDriver joystick_driver = new LegacyJoystickDriver();
KeyboardDevice keyboard = new KeyboardDevice();
MouseDevice mouse = new MouseDevice();
IList<KeyboardDevice> keyboards = new List<KeyboardDevice>(1);
IList<MouseDevice> mice = new List<MouseDevice>(1);
const long ExtendedBit = 1 << 24; // Used to distinguish left and right control, alt and enter keys.
public static readonly uint ShiftLeftScanCode = Functions.MapVirtualKey(VirtualKeys.LSHIFT, 0);