mirror of
https://github.com/overte-org/overte.git
synced 2025-07-26 07:50:04 +02:00
Merge pull request #9189 from huffman/feat/help-touch
Add support for oculus touch in help menu
This commit is contained in:
commit
b4f43e01b1
5 changed files with 83 additions and 20 deletions
|
@ -47,26 +47,70 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
|
var handControllerImageURL = null;
|
||||||
|
|
||||||
function showKbm() {
|
function showKbm() {
|
||||||
document.getElementById("main_image").setAttribute("src", "img/controls-help-keyboard.png");
|
document.getElementById("main_image").setAttribute("src", "img/controls-help-keyboard.png");
|
||||||
}
|
}
|
||||||
function showViveControllers() {
|
|
||||||
document.getElementById("main_image").setAttribute("src", "img/controls-help-vive.png");
|
function showHandControllers() {
|
||||||
|
document.getElementById("main_image").setAttribute("src", handControllerImageURL);
|
||||||
}
|
}
|
||||||
function showXboxController() {
|
|
||||||
|
function showGamepad() {
|
||||||
document.getElementById("main_image").setAttribute("src", "img/controls-help-gamepad.png");
|
document.getElementById("main_image").setAttribute("src", "img/controls-help-gamepad.png");
|
||||||
}
|
}
|
||||||
function load() {
|
|
||||||
console.log("In help.html: ", window.location.href);
|
// This is not meant to be a complete or hardened query string parser - it only
|
||||||
parts = window.location.href.split("?");
|
// needs to handle the values we send in and have control over.
|
||||||
if (parts.length > 0) {
|
//
|
||||||
var defaultTab = parts[1];
|
// queryString is a string of the form "key1=value1&key2=value2&key3&key4=value4"
|
||||||
if (defaultTab == "xbox") {
|
function parseQueryString(queryString) {
|
||||||
showXboxController();
|
var params = {};
|
||||||
} else if (defaultTab == "vive") {
|
var paramsParts = queryString.split("&");
|
||||||
showViveControllers();
|
for (var i = 0; i < paramsParts.length; ++i) {
|
||||||
|
var paramKeyValue = paramsParts[i].split("=");
|
||||||
|
if (paramKeyValue.length == 1) {
|
||||||
|
params[paramKeyValue[0]] = undefined;
|
||||||
|
} else if (paramKeyValue.length == 2) {
|
||||||
|
params[paramKeyValue[0]] = paramKeyValue[1];
|
||||||
|
} else {
|
||||||
|
console.error("Error parsing param keyvalue: ", paramParts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
function load() {
|
||||||
|
var parts = window.location.href.split("?");
|
||||||
|
var params = {};
|
||||||
|
if (parts.length > 0) {
|
||||||
|
params = parseQueryString(parts[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (params.handControllerName) {
|
||||||
|
case "oculus":
|
||||||
|
handControllerImageURL = "img/controls-help-oculus.png";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "vive":
|
||||||
|
default:
|
||||||
|
handControllerImageURL = "img/controls-help-vive.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (params.defaultTab) {
|
||||||
|
case "gamepad":
|
||||||
|
showGamepad();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "handControllers":
|
||||||
|
showHandControllers();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "kbm":
|
||||||
|
default:
|
||||||
|
showKbm();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
@ -75,8 +119,8 @@
|
||||||
<div id="image_area">
|
<div id="image_area">
|
||||||
<img id="main_image" src="img/controls-help-keyboard.png" width="1024px" height="720px"></img>
|
<img id="main_image" src="img/controls-help-keyboard.png" width="1024px" height="720px"></img>
|
||||||
<a href="#" id="kbm_button" onmousedown="showKbm()"></a>
|
<a href="#" id="kbm_button" onmousedown="showKbm()"></a>
|
||||||
<a href="#" id="hand_controllers_button" onmousedown="showViveControllers()"></a>
|
<a href="#" id="hand_controllers_button" onmousedown="showHandControllers()"></a>
|
||||||
<a href="#" id="game_controller_button" onmousedown="showXboxController()"></a>
|
<a href="#" id="game_controller_button" onmousedown="showGamepad()"></a>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
BIN
interface/resources/html/img/controls-help-oculus.png
Normal file
BIN
interface/resources/html/img/controls-help-oculus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 119 KiB |
|
@ -2213,17 +2213,31 @@ void Application::aboutApp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::showHelp() {
|
void Application::showHelp() {
|
||||||
static const QString QUERY_STRING_XBOX = "xbox";
|
static const QString HAND_CONTROLLER_NAME_VIVE = "vive";
|
||||||
static const QString QUERY_STRING_VIVE = "vive";
|
static const QString HAND_CONTROLLER_NAME_OCULUS_TOUCH = "oculus";
|
||||||
|
|
||||||
|
static const QString TAB_KEYBOARD_MOUSE = "kbm";
|
||||||
|
static const QString TAB_GAMEPAD = "gamepad";
|
||||||
|
static const QString TAB_HAND_CONTROLLERS = "handControllers";
|
||||||
|
|
||||||
|
QString handControllerName = HAND_CONTROLLER_NAME_VIVE;
|
||||||
|
QString defaultTab = TAB_KEYBOARD_MOUSE;
|
||||||
|
|
||||||
QString queryString = "";
|
|
||||||
if (PluginUtils::isViveControllerAvailable()) {
|
if (PluginUtils::isViveControllerAvailable()) {
|
||||||
queryString = QUERY_STRING_VIVE;
|
defaultTab = TAB_HAND_CONTROLLERS;
|
||||||
|
handControllerName = HAND_CONTROLLER_NAME_VIVE;
|
||||||
|
} else if (PluginUtils::isOculusTouchControllerAvailable()) {
|
||||||
|
defaultTab = TAB_HAND_CONTROLLERS;
|
||||||
|
handControllerName = HAND_CONTROLLER_NAME_OCULUS_TOUCH;
|
||||||
} else if (PluginUtils::isXboxControllerAvailable()) {
|
} else if (PluginUtils::isXboxControllerAvailable()) {
|
||||||
queryString = QUERY_STRING_XBOX;
|
defaultTab = TAB_GAMEPAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoView::show(INFO_HELP_PATH, false, queryString);
|
QUrlQuery queryString;
|
||||||
|
queryString.addQueryItem("handControllerName", handControllerName);
|
||||||
|
queryString.addQueryItem("defaultTab", defaultTab);
|
||||||
|
|
||||||
|
InfoView::show(INFO_HELP_PATH, false, queryString.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::resizeEvent(QResizeEvent* event) {
|
void Application::resizeEvent(QResizeEvent* event) {
|
||||||
|
|
|
@ -51,6 +51,10 @@ bool PluginUtils::isViveControllerAvailable() {
|
||||||
return isSubdeviceContainingNameAvailable("OpenVR");
|
return isSubdeviceContainingNameAvailable("OpenVR");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool PluginUtils::isOculusTouchControllerAvailable() {
|
||||||
|
return isSubdeviceContainingNameAvailable("OculusTouch");
|
||||||
|
};
|
||||||
|
|
||||||
bool PluginUtils::isXboxControllerAvailable() {
|
bool PluginUtils::isXboxControllerAvailable() {
|
||||||
return isSubdeviceContainingNameAvailable("X360 Controller");
|
return isSubdeviceContainingNameAvailable("X360 Controller");
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,5 +17,6 @@ public:
|
||||||
static bool isHMDAvailable(const QString& pluginName = "");
|
static bool isHMDAvailable(const QString& pluginName = "");
|
||||||
static bool isHandControllerAvailable();
|
static bool isHandControllerAvailable();
|
||||||
static bool isViveControllerAvailable();
|
static bool isViveControllerAvailable();
|
||||||
|
static bool isOculusTouchControllerAvailable();
|
||||||
static bool isXboxControllerAvailable();
|
static bool isXboxControllerAvailable();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue