feat(input): Add arrow key input
This commit is contained in:
22
src/input.c
22
src/input.c
@@ -187,6 +187,28 @@ quat_t poll_input(window_t window)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (glfwGetKey((GLFWwindow *)window, GLFW_KEY_UP) == GLFW_PRESS)
|
||||
{
|
||||
glm_quatv(p, ANGLE, (vec3){1,0,0});
|
||||
goto end;
|
||||
}
|
||||
if (glfwGetKey((GLFWwindow *)window, GLFW_KEY_DOWN) == GLFW_PRESS)
|
||||
{
|
||||
glm_quatv(p, -ANGLE, (vec3){1,0,0});
|
||||
goto end;
|
||||
}
|
||||
if (glfwGetKey((GLFWwindow *)window, GLFW_KEY_RIGHT) == GLFW_PRESS)
|
||||
{
|
||||
glm_quatv(p, ANGLE, (vec3){0,1,0});
|
||||
goto end;
|
||||
}
|
||||
if (glfwGetKey((GLFWwindow *)window, GLFW_KEY_LEFT) == GLFW_PRESS)
|
||||
{
|
||||
|
||||
glm_quatv(p, -ANGLE, (vec3){0,1,0});
|
||||
goto end;
|
||||
}
|
||||
|
||||
end:
|
||||
glm_quat_mul(p, q, q);
|
||||
glm_quat_rotatev(p, axis[0], axis[0]);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "main.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
|
||||
@@ -106,6 +106,7 @@ void draw_mesh_lines(id_t shader, mesh_t p)
|
||||
{
|
||||
struct obj *obj = p;
|
||||
|
||||
glLineWidth(4);
|
||||
glUseProgram(shader);
|
||||
glBindVertexArray(obj->vao);
|
||||
#ifndef EMSCRIPTEN
|
||||
|
||||
Reference in New Issue
Block a user