mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 16:23:17 +02:00
xbox controller works on restart
This commit is contained in:
parent
dd97f16728
commit
5daccba235
3 changed files with 7 additions and 3 deletions
|
@ -77,7 +77,7 @@ void UserInputMapper::registerDevice(InputDevice::Pointer device) {
|
||||||
}
|
}
|
||||||
const auto& deviceID = device->_deviceID;
|
const auto& deviceID = device->_deviceID;
|
||||||
|
|
||||||
//recordDeviceOfType(device->getName());
|
recordDeviceOfType(device->getName());
|
||||||
|
|
||||||
qCDebug(controllers) << "Registered input device <" << device->getName() << "> deviceID = " << deviceID;
|
qCDebug(controllers) << "Registered input device <" << device->getName() << "> deviceID = " << deviceID;
|
||||||
|
|
||||||
|
@ -126,6 +126,10 @@ void UserInputMapper::removeDevice(int deviceID) {
|
||||||
auto device = proxyEntry->second;
|
auto device = proxyEntry->second;
|
||||||
qCDebug(controllers) << "Unregistering input device <" << device->getName() << "> deviceID = " << deviceID;
|
qCDebug(controllers) << "Unregistering input device <" << device->getName() << "> deviceID = " << deviceID;
|
||||||
|
|
||||||
|
if (!_deviceCounts.contains(device->getName())) {
|
||||||
|
_deviceCounts[device->getName()] -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
unloadMappings(device->getDefaultMappingConfigs());
|
unloadMappings(device->getDefaultMappingConfigs());
|
||||||
|
|
||||||
auto mappingsEntry = _mappingsByDevice.find(deviceID);
|
auto mappingsEntry = _mappingsByDevice.find(deviceID);
|
||||||
|
|
|
@ -142,7 +142,7 @@ namespace controller {
|
||||||
std::vector<float> _lastStandardStates = std::vector<float>();
|
std::vector<float> _lastStandardStates = std::vector<float>();
|
||||||
|
|
||||||
int recordDeviceOfType(const QString& deviceName);
|
int recordDeviceOfType(const QString& deviceName);
|
||||||
QHash<const QString&, int> _deviceCounts;
|
QHash<const QString, int> _deviceCounts;
|
||||||
|
|
||||||
static float getValue(const EndpointPointer& endpoint, bool peek = false);
|
static float getValue(const EndpointPointer& endpoint, bool peek = false);
|
||||||
static Pose getPose(const EndpointPointer& endpoint, bool peek = false);
|
static Pose getPose(const EndpointPointer& endpoint, bool peek = false);
|
||||||
|
|
|
@ -64,7 +64,7 @@ void Joystick::handleButtonEvent(const SDL_ControllerButtonEvent& event) {
|
||||||
|
|
||||||
controller::Input::NamedVector Joystick::getAvailableInputs() const {
|
controller::Input::NamedVector Joystick::getAvailableInputs() const {
|
||||||
using namespace controller;
|
using namespace controller;
|
||||||
static const Input::NamedVector availableInputs{
|
const Input::NamedVector availableInputs{
|
||||||
makePair(A, "A"),
|
makePair(A, "A"),
|
||||||
makePair(B, "B"),
|
makePair(B, "B"),
|
||||||
makePair(X, "X"),
|
makePair(X, "X"),
|
||||||
|
|
Loading…
Reference in a new issue