Fix InputController (Leap Motion) not being updated

This commit is contained in:
David Rowe 2015-11-25 09:43:55 +13:00
parent e25d4c17e8
commit 5ecbaa5b93
3 changed files with 11 additions and 2 deletions

View file

@ -2825,6 +2825,8 @@ void Application::update(float deltaTime) {
}
}
_controllerScriptingInterface->updateInputControllers();
// Transfer the user inputs to the driveKeys
// FIXME can we drop drive keys and just have the avatar read the action states directly?
myAvatar->clearDriveKeys();

View file

@ -89,8 +89,7 @@ controller::InputController* ControllerScriptingInterface::createInputController
auto icIt = _inputControllers.find(0);
if (icIt != _inputControllers.end()) {
return (*icIt).second.get();
}
}
// Look for device
DeviceTracker::ID deviceID = DeviceTracker::getDeviceID(deviceName.toStdString());
@ -122,6 +121,12 @@ void ControllerScriptingInterface::releaseInputController(controller::InputContr
_inputControllers.erase(input->getKey());
}
void ControllerScriptingInterface::updateInputControllers() {
for (auto it = _inputControllers.begin(); it != _inputControllers.end(); it++) {
(*it).second->update();
}
}
InputController::InputController(int deviceTrackerId, int subTrackerId, QObject* parent) :
_deviceTrackerId(deviceTrackerId),
_subTrackerId(subTrackerId),

View file

@ -85,6 +85,8 @@ public:
bool isKeyCaptured(const KeyEvent& event) const;
bool isJoystickCaptured(int joystickIndex) const;
void updateInputControllers();
public slots:
virtual void captureKeyEvents(const KeyEvent& event);