From a40fed579bd183800cbb394d36c99441e0a1f082 Mon Sep 17 00:00:00 2001 From: Ben Campbell Date: Sat, 14 Oct 2017 10:04:41 +1300 Subject: [PATCH] fake headset: add cursor key support --- src/headset/fake.c | 8 ++++---- src/headset/fake.h | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/headset/fake.c b/src/headset/fake.c index b65f9d2a..502cf625 100644 --- a/src/headset/fake.c +++ b/src/headset/fake.c @@ -360,16 +360,16 @@ void lovrHeadsetUpdate(float dt) float k = 4.0f; GLFWwindow* w = state.window; 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; } - 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; } - 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; } - 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; } if (glfwGetKey(w, GLFW_KEY_SPACE) == GLFW_PRESS) { diff --git a/src/headset/fake.h b/src/headset/fake.h index e93c5d49..24fa367b 100644 --- a/src/headset/fake.h +++ b/src/headset/fake.h @@ -9,5 +9,11 @@ #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(); Controller* lovrHeadsetAddController(unsigned int id);