mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-08 23:23:38 +00:00
fake headset: add cursor key support
This commit is contained in:
parent
0ed41b690a
commit
a40fed579b
|
@ -360,16 +360,16 @@ void lovrHeadsetUpdate(float dt)
|
||||||
float k = 4.0f;
|
float k = 4.0f;
|
||||||
GLFWwindow* w = state.window;
|
GLFWwindow* w = state.window;
|
||||||
float v[3] = {0.0f,0.0f,0.0f};
|
float v[3] = {0.0f,0.0f,0.0f};
|
||||||
if (glfwGetKey(w, GLFW_KEY_W) == GLFW_PRESS) {
|
if (glfwGetKey(w, GLFW_KEY_W)==GLFW_PRESS || glfwGetKey(w, GLFW_KEY_UP)==GLFW_PRESS) {
|
||||||
v[2] = -k;
|
v[2] = -k;
|
||||||
}
|
}
|
||||||
if (glfwGetKey(w, GLFW_KEY_S) == GLFW_PRESS) {
|
if (glfwGetKey(w, GLFW_KEY_S)==GLFW_PRESS || glfwGetKey(w, GLFW_KEY_DOWN)==GLFW_PRESS) {
|
||||||
v[2] = k;
|
v[2] = k;
|
||||||
}
|
}
|
||||||
if (glfwGetKey(w, GLFW_KEY_A) == GLFW_PRESS) {
|
if (glfwGetKey(w, GLFW_KEY_A)==GLFW_PRESS || glfwGetKey(w, GLFW_KEY_LEFT)==GLFW_PRESS) {
|
||||||
v[0] = -k;
|
v[0] = -k;
|
||||||
}
|
}
|
||||||
if (glfwGetKey(w, GLFW_KEY_D) == GLFW_PRESS) {
|
if (glfwGetKey(w, GLFW_KEY_D)==GLFW_PRESS || glfwGetKey(w, GLFW_KEY_RIGHT)==GLFW_PRESS) {
|
||||||
v[0] = k;
|
v[0] = k;
|
||||||
}
|
}
|
||||||
if (glfwGetKey(w, GLFW_KEY_SPACE) == GLFW_PRESS) {
|
if (glfwGetKey(w, GLFW_KEY_SPACE) == GLFW_PRESS) {
|
||||||
|
|
|
@ -9,5 +9,11 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
/* A default fake headset to stand in for a missing VR one.
|
||||||
|
* uses mouse to look around, WASD or cursor keys to move.
|
||||||
|
* Left shift and Space move up and down.
|
||||||
|
*/
|
||||||
|
|
||||||
void lovrHeadsetRefreshControllers();
|
void lovrHeadsetRefreshControllers();
|
||||||
Controller* lovrHeadsetAddController(unsigned int id);
|
Controller* lovrHeadsetAddController(unsigned int id);
|
||||||
|
|
Loading…
Reference in a new issue