Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.

Can't differentiate multiple gamepad inputs on macOS #58

Open
ShamylZakariya opened this issue Jul 31, 2018 · 0 comments
Open

Can't differentiate multiple gamepad inputs on macOS #58

ShamylZakariya opened this issue Jul 31, 2018 · 0 comments

Comments

@ShamylZakariya
Copy link

I connect two PS4 controllers to my mac (10.13) and create two gainput::InputDevicePad instances.

_gamepads.push_back(_inputManager->CreateDevice<gainput::InputDevicePad>());
_gamepads.push_back(_inputManager->CreateDevice<gainput::InputDevicePad>());

In a polling loop I print the state of the left and right analog sticks for the two devices.

auto device1 = _inputManager->GetDevice(_gamepads[0]);
auto device2 = _inputManager->GetDevice(_gamepads[1]);

vec2 leftStick1(device1->GetFloat(gainput::PadButtonLeftStickX),device1->GetFloat(gainput::PadButtonLeftStickY));
vec2 rightStick1(device1->GetFloat(gainput::PadButtonRightStickX),device1->GetFloat(gainput::PadButtonRightStickY));
vec2 leftStick2(device2->GetFloat(gainput::PadButtonLeftStickX),device2->GetFloat(gainput::PadButtonLeftStickY));
vec2 rightStick2(device2->GetFloat(gainput::PadButtonRightStickX),device2->GetFloat(gainput::PadButtonRightStickY));

cout << "leftStick1: " << leftStick1 << " rightStick1:" << rightStick1 << endl;
cout << "leftStick2: " << leftStick2 << " rightStick2:" << rightStick2 << endl << endl;

If I move the analog sticks on either gamepad 1 or 2, I see its position reflected in both device1 and device2.

gainput is, I guess, merging the state of the two controllers.

Am I creating the devices incorrectly?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant