mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 08:14:48 +02:00
Add vive and xbox controller checking to PluginUtils
This commit is contained in:
parent
ba0dbeac80
commit
e4341d7a02
2 changed files with 23 additions and 0 deletions
|
@ -32,3 +32,24 @@ bool PluginUtils::isHandControllerAvailable() {
|
|||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
bool isSubdeviceContainingNameAvailable(QString name) {
|
||||
for (auto& inputPlugin : PluginManager::getInstance()->getInputPlugins()) {
|
||||
auto subdeviceNames = inputPlugin->getSubdeviceNames();
|
||||
for (auto& name : subdeviceNames) {
|
||||
if (name.contains(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
bool PluginUtils::isViveControllerAvailable() {
|
||||
return isSubdeviceContainingNameAvailable("Vive");
|
||||
};
|
||||
|
||||
bool PluginUtils::isXboxControllerAvailable() {
|
||||
return isSubdeviceContainingNameAvailable("X360 Controller");
|
||||
};
|
||||
|
||||
|
|
|
@ -16,4 +16,6 @@ class PluginUtils {
|
|||
public:
|
||||
static bool isHMDAvailable(const QString& pluginName = "");
|
||||
static bool isHandControllerAvailable();
|
||||
static bool isViveControllerAvailable();
|
||||
static bool isXboxControllerAvailable();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue