summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-26 18:58:43 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-26 18:58:43 +1000
commitf5e5a6fdf58f3135f3211135bfbcb6e70630309f (patch)
tree0d58ffe229df9ed907219537b78d2a88d10b331d /src
parentaa1eeebb1c05edc22335cbb48af5d42be20750c0 (diff)
fix glfw get key range so it doesnt panic on mac
Diffstat (limited to 'src')
-rw-r--r--src/core/core.c2
-rw-r--r--src/systems/input.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/core/core.c b/src/core/core.c
index 44db7b1..20bc813 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -68,7 +68,7 @@ bool ShouldExit() {
}
void Frame_Begin() {
- // Input_Update(&g_core.input);
+ Input_Update(&g_core.input);
Render_FrameBegin(g_core.renderer);
}
void Frame_Draw() {}
diff --git a/src/systems/input.c b/src/systems/input.c
index fa76273..b5cdcdb 100644
--- a/src/systems/input.c
+++ b/src/systems/input.c
@@ -4,6 +4,7 @@
#include <glfw3.h>
#include <string.h>
+#include "keys.h"
#include "log.h"
static Input_State *g_input; // Use a global to simplify caller code
@@ -14,7 +15,7 @@ bool Input_Init(Input_State *input, GLFWwindow *window) {
input->window = window;
// Set everything to false. Could just set memory to zero but where's the fun in that
- for (int i = 0; i < KEYCODE_MAX; i++) {
+ for (int i = KEYCODE_SPACE; i < KEYCODE_MAX; i++) {
input->depressed_keys[i] = false;
input->just_pressed_keys[i] = false;
input->just_released_keys[i] = false;
@@ -37,7 +38,7 @@ void Input_Update(Input_State *input) {
// if we go from un-pressed -> pressed, set as "just pressed"
// if we go from pressed -> un-pressed, set as "just released"
- for (int i = 0; i < KEYCODE_MAX; i++) {
+ for (int i = KEYCODE_SPACE; i < KEYCODE_MAX; i++) {
bool new_state = false;
if (glfwGetKey(input->window, i) == GLFW_PRESS) {
new_state = true;