1
0
Fork 0
mirror of https://github.com/bjornbytes/lovr.git synced 2024-07-03 04:53:35 +00:00

fake headset: add cursor key support

This commit is contained in:
Ben Campbell 2017-10-14 10:04:41 +13:00
parent 0ed41b690a
commit a40fed579b
2 changed files with 10 additions and 4 deletions

View file

@ -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) {

View file

@ -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);