initial commit for multiple DInput devices.

allow multiple dinput devices but still block all dinput devices if an xinput device is present.
This still has some issues with devices not being able to be dynamically added or removed but
even many commercial games react to hot-plug DInput events. Also, the axis handling is not really
ideal yet but it works for now.
This commit is contained in:
Peter Tissen committed 2014-06-01 12:37:30 +02:00
1 parent 0c7c736522
commit 1024eb7b63
3 files changed
+129 -45

No files matched your search

+7 -3
View File
@@ -84,10 +84,14 @@ WindowsHost::WindowsHost(HWND mainWindow) {
mouseDeltaX = 0;
mouseDeltaY = 0;
#define PUSH_BACK(Cls) do { list.push_back(std::shared_ptr<InputDevice>(new Cls())); } while (0)
//add first XInput device to respond
input.push_back(std::shared_ptr<InputDevice>(new XinputDevice()));
input.push_back(std::shared_ptr<InputDevice>(new DinputDevice()));
//find all connected DInput devices of class GamePad
int numDInputDevs = DinputDevice::getNumPads();
for (int i = 0; i < numDInputDevs; i++)
{
input.push_back(std::shared_ptr<InputDevice>(new DinputDevice(i)));
}
keyboard = std::shared_ptr<KeyboardDevice>(new KeyboardDevice());
input.push_back(keyboard);