From ad50ee243d9d7ac30ef507acd01bbc4ccb02f862 Mon Sep 17 00:00:00 2001 From: sanine-a Date: Fri, 22 May 2020 22:30:07 -0500 Subject: add keyboard input --- CMakeLists.txt | 2 +- demo.c | 43 +-- include/common.h | 2 + include/honey.h | 3 +- include/input.h | 180 +++++++++ include/keycodes.txt | 121 ++++++ src/honey.c | 3 + src/input.c | 1018 ++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 1342 insertions(+), 30 deletions(-) create mode 100644 include/input.h create mode 100644 include/keycodes.txt create mode 100644 src/input.c diff --git a/CMakeLists.txt b/CMakeLists.txt index a0f9d68..5df80b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ add_executable(honey_engine_demo demo.c) set(CMAKE_C_FLAGS "-g") -add_library(honey src/honey.c src/camera.c src/mesh.c src/primitives.c src/shader.c src/texture.c) +add_library(honey src/honey.c src/camera.c src/input.c src/mesh.c src/primitives.c src/shader.c src/texture.c) add_library(glad src/glad.c) add_library(stb_image src/stb_image.c) diff --git a/demo.c b/demo.c index d7df41b..2aafc46 100644 --- a/demo.c +++ b/demo.c @@ -18,7 +18,6 @@ honey_texture happy_face; mat4 model, view, projection; bool wireframe = false; -bool fKeyDown = false; /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ @@ -58,57 +57,45 @@ void mouseCallback(GLFWwindow* window, double x, double y) { /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -void print_vec3(vec3 v) { - printf("(%f, %f, %f)\n", v[0], v[1], v[2]); +void toggle_wireframe(void* data, int action) { + if (action == HONEY_PRESS_KEY) { wireframe = !wireframe; } } +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + void update(float dt) { glfwPollEvents(); - printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); - print_vec3(camera.look_direction); - print_vec3(camera.up); - print_vec3(camera.right); - - //glm_rotate_x(model, glm_rad(10*dt), model); + glm_rotate_x(model, glm_rad(10*dt), model); - if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) { + if (honey_key_down(HONEY_KEY_ESCAPE)) { glfwSetWindowShouldClose(window, true); } - if (glfwGetKey(window, GLFW_KEY_F) == GLFW_PRESS) { - if (!fKeyDown) { - wireframe = !wireframe; - fKeyDown = true; - } - } - if (glfwGetKey(window, GLFW_KEY_F) == GLFW_RELEASE) { - fKeyDown = false; - } - if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) { + if (honey_key_down(HONEY_KEY_W)) { vec3 step; glm_vec3_scale(camera.look_direction, cameraSpeed*dt, step); glm_vec3_add(camera.position, step, camera.position); } - if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) { + if (honey_key_down(HONEY_KEY_S)) { vec3 step; glm_vec3_scale(camera.look_direction, -cameraSpeed*dt, step); glm_vec3_add(camera.position, step, camera.position); } - if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS) { + if (honey_key_down(HONEY_KEY_A)) { vec3 step; glm_vec3_scale(camera.right, cameraSpeed*dt, step); glm_vec3_add(camera.position, step, camera.position); } - if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS) { + if (honey_key_down(HONEY_KEY_D)) { vec3 step; glm_vec3_scale(camera.right, -cameraSpeed*dt, step); glm_vec3_add(camera.position, step, camera.position); } - if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS) { + if (honey_key_down(HONEY_KEY_E)) { camera.angle[2] += camera_roll_speed*dt; } - if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS) { + if (honey_key_down(HONEY_KEY_Q)) { camera.angle[2] -= camera_roll_speed*dt; } @@ -149,6 +136,8 @@ int main() { honey_set_resize_callback(window, framebufferResizeCallback); honey_set_mouse_move_callback(window, mouseCallback); + honey_key_bind(HONEY_KEY_F, toggle_wireframe, NULL); + /* load container texture */ if (honey_texture_new(&container, "container.jpg", false) != TEXTURE_OK) { return 1; @@ -175,8 +164,8 @@ int main() { //glm_rotate_x(model, glm_rad(-55), model); honey_shader_set_mat4(shader, "model", model); - vec3 camera_pos = { 4, 0, 0 }; - vec3 camera_angle = { 0, glm_rad(180), 0 }; + vec3 camera_pos = { -4, 0, 0 }; + vec3 camera_angle = { 0, 0, 0 }; float camera_near = 0.1; float camera_far = 100; float camera_fov = glm_rad(45); diff --git a/include/common.h b/include/common.h index 8c1f976..e76d53c 100644 --- a/include/common.h +++ b/include/common.h @@ -14,4 +14,6 @@ #include "stb_image.h" +typedef GLFWwindow* honey_window; + #endif diff --git a/include/honey.h b/include/honey.h index 3dbc5ab..ccbaf8f 100644 --- a/include/honey.h +++ b/include/honey.h @@ -8,13 +8,12 @@ #include "camera.h" #include "common.h" +#include "input.h" #include "mesh.h" #include "primitives.h" #include "shader.h" #include "texture.h" -typedef GLFWwindow* honey_window; - /** @brief Initialize Honey. * * @param[in] screen_width The desired width of the screen in pixels diff --git a/include/input.h b/include/input.h new file mode 100644 index 0000000..6482f1f --- /dev/null +++ b/include/input.h @@ -0,0 +1,180 @@ +#ifndef HONEY_INPUT_H +#define HONEY_INPUT_H + +/** @file input.h + * + * @brief Wrap GLFW input functions for honey. + */ + +#include "common.h" + +#define HONEY_KEY_UNKNOWN 0 +#define HONEY_KEY_SPACE 1 +#define HONEY_KEY_APOSTROPHE 2 +#define HONEY_KEY_COMMA 3 +#define HONEY_KEY_MINUS 4 +#define HONEY_KEY_PERIOD 5 +#define HONEY_KEY_SLASH 6 +#define HONEY_KEY_0 7 +#define HONEY_KEY_1 8 +#define HONEY_KEY_2 9 +#define HONEY_KEY_3 10 +#define HONEY_KEY_4 11 +#define HONEY_KEY_5 12 +#define HONEY_KEY_6 13 +#define HONEY_KEY_7 14 +#define HONEY_KEY_8 15 +#define HONEY_KEY_9 16 +#define HONEY_KEY_SEMICOLON 17 +#define HONEY_KEY_EQUAL 18 +#define HONEY_KEY_A 19 +#define HONEY_KEY_B 20 +#define HONEY_KEY_C 21 +#define HONEY_KEY_D 22 +#define HONEY_KEY_E 23 +#define HONEY_KEY_F 24 +#define HONEY_KEY_G 25 +#define HONEY_KEY_H 26 +#define HONEY_KEY_I 27 +#define HONEY_KEY_J 28 +#define HONEY_KEY_K 29 +#define HONEY_KEY_L 30 +#define HONEY_KEY_M 31 +#define HONEY_KEY_N 32 +#define HONEY_KEY_O 33 +#define HONEY_KEY_P 34 +#define HONEY_KEY_Q 35 +#define HONEY_KEY_R 36 +#define HONEY_KEY_S 37 +#define HONEY_KEY_T 38 +#define HONEY_KEY_U 39 +#define HONEY_KEY_V 40 +#define HONEY_KEY_W 41 +#define HONEY_KEY_X 42 +#define HONEY_KEY_Y 43 +#define HONEY_KEY_Z 44 +#define HONEY_KEY_LEFT_BRACKET 45 +#define HONEY_KEY_BACKSLASH 46 +#define HONEY_KEY_RIGHT_BRACKET 47 +#define HONEY_KEY_GRAVE_ACCENT 48 +#define HONEY_KEY_WORLD_1 49 +#define HONEY_KEY_WORLD_2 50 +#define HONEY_KEY_ESCAPE 51 +#define HONEY_KEY_ENTER 52 +#define HONEY_KEY_TAB 53 +#define HONEY_KEY_BACKSPACE 54 +#define HONEY_KEY_INSERT 55 +#define HONEY_KEY_DELETE 56 +#define HONEY_KEY_RIGHT 57 +#define HONEY_KEY_LEFT 58 +#define HONEY_KEY_DOWN 59 +#define HONEY_KEY_UP 60 +#define HONEY_KEY_PAGE_UP 61 +#define HONEY_KEY_PAGE_DOWN 62 +#define HONEY_KEY_HOME 63 +#define HONEY_KEY_END 64 +#define HONEY_KEY_CAPS_LOCK 65 +#define HONEY_KEY_SCROLL_LOCK 66 +#define HONEY_KEY_NUM_LOCK 67 +#define HONEY_KEY_PRINT_SCREEN 68 +#define HONEY_KEY_PAUSE 69 +#define HONEY_KEY_F1 70 +#define HONEY_KEY_F2 71 +#define HONEY_KEY_F3 72 +#define HONEY_KEY_F4 73 +#define HONEY_KEY_F5 74 +#define HONEY_KEY_F6 75 +#define HONEY_KEY_F7 76 +#define HONEY_KEY_F8 77 +#define HONEY_KEY_F9 78 +#define HONEY_KEY_F10 79 +#define HONEY_KEY_F11 80 +#define HONEY_KEY_F12 81 +#define HONEY_KEY_F13 82 +#define HONEY_KEY_F14 83 +#define HONEY_KEY_F15 84 +#define HONEY_KEY_F16 85 +#define HONEY_KEY_F17 86 +#define HONEY_KEY_F18 87 +#define HONEY_KEY_F19 88 +#define HONEY_KEY_F20 89 +#define HONEY_KEY_F21 90 +#define HONEY_KEY_F22 91 +#define HONEY_KEY_F23 92 +#define HONEY_KEY_F24 93 +#define HONEY_KEY_F25 94 +#define HONEY_KEY_KP_0 95 +#define HONEY_KEY_KP_1 96 +#define HONEY_KEY_KP_2 97 +#define HONEY_KEY_KP_3 98 +#define HONEY_KEY_KP_4 99 +#define HONEY_KEY_KP_5 100 +#define HONEY_KEY_KP_6 101 +#define HONEY_KEY_KP_7 102 +#define HONEY_KEY_KP_8 103 +#define HONEY_KEY_KP_9 104 +#define HONEY_KEY_KP_DECIMAL 105 +#define HONEY_KEY_KP_DIVIDE 106 +#define HONEY_KEY_KP_MULTIPLY 107 +#define HONEY_KEY_KP_SUBTRACT 108 +#define HONEY_KEY_KP_ADD 109 +#define HONEY_KEY_KP_ENTER 110 +#define HONEY_KEY_KP_EQUAL 111 +#define HONEY_KEY_LEFT_SHIFT 112 +#define HONEY_KEY_LEFT_CONTROL 113 +#define HONEY_KEY_LEFT_ALT 114 +#define HONEY_KEY_LEFT_SUPER 115 +#define HONEY_KEY_RIGHT_SHIFT 116 +#define HONEY_KEY_RIGHT_CONTROL 117 +#define HONEY_KEY_RIGHT_ALT 118 +#define HONEY_KEY_RIGHT_SUPER 119 +#define HONEY_KEY_MENU 120 + +#define HONEY_N_KEYS 121 + +#define HONEY_PRESS_KEY GLFW_PRESS +#define HONEY_RELEASE_KEY GLFW_RELEASE + +unsigned int honey_key_states[HONEY_N_KEYS]; +static void (*honey_key_callbacks[HONEY_N_KEYS])(void*, int); +static void* honey_key_callbacks_data[HONEY_N_KEYS]; +static void (*honey_keyboard_callback)(honey_window window, int key, int scancode, int action, int mods); + +/** @brief Initializes Honey's internal keyboard states. + * + * This function is called by honey_setup, so you shouldn't need + * to manually call it in most cases. + */ +void honey_setup_keyboard(); + +/** @brief Check if a key is down. + * + * @param[in] key The key to query. + * + * @return TRUE if the key is presently held down; FALSE if it is not, or if the keycode was out of bounds. + */ +bool honey_key_down(int key); + +/** @brief Bind a callback to a key. + * + * The callback must have signature (void*, int), where the first argument is supplied by the + * void* supplied with this function, and the int is one of HONEY_KEY_PRESS or HONEY_KEY_RELEASE, + * depending on the action that triggered the callback. + * + * @param[in] key The key to bind the callback to. + * @param[in] callback The callback function to bind. + * @param[in] data Data to pass to the callback function upon triggering. + */ +void honey_key_bind(int key, void (*callback)(void*, int), void* data); + +/** @brief Unbind a key callback. + * + * THIS FUNCTION DOES NOT FREE MEMORY! If you allocated any, be sure to free it yourself! + * + * @param[in] key The key to unbind a callback from. + */ +void honey_key_unbind(int key); + +void default_honey_keyboard_callback(honey_window window, int key, int scancode, int action, int mods); + +#endif diff --git a/include/keycodes.txt b/include/keycodes.txt new file mode 100644 index 0000000..12f35b3 --- /dev/null +++ b/include/keycodes.txt @@ -0,0 +1,121 @@ +GLFW_KEY_UNKNOWN +GLFW_KEY_SPACE +GLFW_KEY_APOSTROPHE +GLFW_KEY_COMMA +GLFW_KEY_MINUS +GLFW_KEY_PERIOD +GLFW_KEY_SLASH +GLFW_KEY_0 +GLFW_KEY_1 +GLFW_KEY_2 +GLFW_KEY_3 +GLFW_KEY_4 +GLFW_KEY_5 +GLFW_KEY_6 +GLFW_KEY_7 +GLFW_KEY_8 +GLFW_KEY_9 +GLFW_KEY_SEMICOLON +GLFW_KEY_EQUAL +GLFW_KEY_A +GLFW_KEY_B +GLFW_KEY_C +GLFW_KEY_D +GLFW_KEY_E +GLFW_KEY_F +GLFW_KEY_G +GLFW_KEY_H +GLFW_KEY_I +GLFW_KEY_J +GLFW_KEY_K +GLFW_KEY_L +GLFW_KEY_M +GLFW_KEY_N +GLFW_KEY_O +GLFW_KEY_P +GLFW_KEY_Q +GLFW_KEY_R +GLFW_KEY_S +GLFW_KEY_T +GLFW_KEY_U +GLFW_KEY_V +GLFW_KEY_W +GLFW_KEY_X +GLFW_KEY_Y +GLFW_KEY_Z +GLFW_KEY_LEFT_BRACKET +GLFW_KEY_BACKSLASH +GLFW_KEY_RIGHT_BRACKET +GLFW_KEY_GRAVE_ACCENT +GLFW_KEY_WORLD_1 +GLFW_KEY_WORLD_2 +GLFW_KEY_ESCAPE +GLFW_KEY_ENTER +GLFW_KEY_TAB +GLFW_KEY_BACKSPACE +GLFW_KEY_INSERT +GLFW_KEY_DELETE +GLFW_KEY_RIGHT +GLFW_KEY_LEFT +GLFW_KEY_DOWN +GLFW_KEY_UP +GLFW_KEY_PAGE_UP +GLFW_KEY_PAGE_DOWN +GLFW_KEY_HOME +GLFW_KEY_END +GLFW_KEY_CAPS_LOCK +GLFW_KEY_SCROLL_LOCK +GLFW_KEY_NUM_LOCK +GLFW_KEY_PRINT_SCREEN +GLFW_KEY_PAUSE +GLFW_KEY_F1 +GLFW_KEY_F2 +GLFW_KEY_F3 +GLFW_KEY_F4 +GLFW_KEY_F5 +GLFW_KEY_F6 +GLFW_KEY_F7 +GLFW_KEY_F8 +GLFW_KEY_F9 +GLFW_KEY_F10 +GLFW_KEY_F11 +GLFW_KEY_F12 +GLFW_KEY_F13 +GLFW_KEY_F14 +GLFW_KEY_F15 +GLFW_KEY_F16 +GLFW_KEY_F17 +GLFW_KEY_F18 +GLFW_KEY_F19 +GLFW_KEY_F20 +GLFW_KEY_F21 +GLFW_KEY_F22 +GLFW_KEY_F23 +GLFW_KEY_F24 +GLFW_KEY_F25 +GLFW_KEY_KP_0 +GLFW_KEY_KP_1 +GLFW_KEY_KP_2 +GLFW_KEY_KP_3 +GLFW_KEY_KP_4 +GLFW_KEY_KP_5 +GLFW_KEY_KP_6 +GLFW_KEY_KP_7 +GLFW_KEY_KP_8 +GLFW_KEY_KP_9 +GLFW_KEY_KP_DECIMAL +GLFW_KEY_KP_DIVIDE +GLFW_KEY_KP_MULTIPLY +GLFW_KEY_KP_SUBTRACT +GLFW_KEY_KP_ADD +GLFW_KEY_KP_ENTER +GLFW_KEY_KP_EQUAL +GLFW_KEY_LEFT_SHIFT +GLFW_KEY_LEFT_CONTROL +GLFW_KEY_LEFT_ALT +GLFW_KEY_LEFT_SUPER +GLFW_KEY_RIGHT_SHIFT +GLFW_KEY_RIGHT_CONTROL +GLFW_KEY_RIGHT_ALT +GLFW_KEY_RIGHT_SUPER +GLFW_KEY_MENU diff --git a/src/honey.c b/src/honey.c index e9396f1..d5b3cd7 100644 --- a/src/honey.c +++ b/src/honey.c @@ -28,6 +28,9 @@ honey_window honey_setup(int screen_width, int screen_height, char* window_title return NULL; } + honey_setup_keyboard(); + glfwSetKeyCallback(window, default_honey_keyboard_callback); + // Enable blending glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); diff --git a/src/input.c b/src/input.c new file mode 100644 index 0000000..7188560 --- /dev/null +++ b/src/input.c @@ -0,0 +1,1018 @@ +#include "include/input.h" + +void honey_setup_keyboard() { + memset(honey_key_states, 0, sizeof(honey_key_states)); + memset(honey_key_callbacks, 0, sizeof(honey_key_callbacks)); + memset(honey_key_callbacks_data, 0, sizeof(honey_key_callbacks_data)); + + honey_keyboard_callback = &default_honey_keyboard_callback; +} + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +bool honey_key_down(int key) { + if (key < 0 || key >= HONEY_N_KEYS) { + return false; + } + return (bool) honey_key_states[key]; +} + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +void honey_key_bind(int key, + void (*callback)(void*, int), + void* data) { + if (key >= 0 && key < HONEY_N_KEYS) { + honey_key_callbacks[key] = callback; + honey_key_callbacks_data[key] = data; + } +} + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +void honey_key_unbind(int key) { + if (key >=0 && key < HONEY_N_KEYS) { + honey_key_callbacks[key] = NULL; + honey_key_callbacks_data[key] = NULL; + } +} + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +void default_honey_keyboard_callback(honey_window window, int key, int scancode, int action, int mods) { + switch (key) { + case GLFW_KEY_UNKNOWN: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_UNKNOWN] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_UNKNOWN] = 0; } + if (honey_key_callbacks[HONEY_KEY_UNKNOWN] != NULL) { + honey_key_callbacks[HONEY_KEY_UNKNOWN](honey_key_callbacks_data[HONEY_KEY_UNKNOWN], + action); + } + break; + case GLFW_KEY_SPACE: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_SPACE] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_SPACE] = 0; } + if (honey_key_callbacks[HONEY_KEY_SPACE] != NULL) { + honey_key_callbacks[HONEY_KEY_SPACE] (honey_key_callbacks_data[HONEY_KEY_SPACE], + action); + } + break; + case GLFW_KEY_APOSTROPHE: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_APOSTROPHE] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_APOSTROPHE] = 0; } + if (honey_key_callbacks[HONEY_KEY_APOSTROPHE] != NULL) { + honey_key_callbacks[HONEY_KEY_APOSTROPHE] (honey_key_callbacks_data[HONEY_KEY_APOSTROPHE], + action); + } + break; + case GLFW_KEY_COMMA: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_COMMA] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_COMMA] = 0; } + if (honey_key_callbacks[HONEY_KEY_COMMA] != NULL) { + honey_key_callbacks[HONEY_KEY_COMMA] (honey_key_callbacks_data[HONEY_KEY_COMMA], + action); + } + break; + case GLFW_KEY_MINUS: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_MINUS] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_MINUS] = 0; } + if (honey_key_callbacks[HONEY_KEY_MINUS] != NULL) { + honey_key_callbacks[HONEY_KEY_MINUS] (honey_key_callbacks_data[HONEY_KEY_MINUS], + action); + } + break; + case GLFW_KEY_PERIOD: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_PERIOD] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_PERIOD] = 0; } + if (honey_key_callbacks[HONEY_KEY_PERIOD] != NULL) { + honey_key_callbacks[HONEY_KEY_PERIOD] (honey_key_callbacks_data[HONEY_KEY_PERIOD], + action); + } + break; + case GLFW_KEY_SLASH: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_SLASH] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_SLASH] = 0; } + if (honey_key_callbacks[HONEY_KEY_SLASH] != NULL) { + honey_key_callbacks[HONEY_KEY_SLASH] (honey_key_callbacks_data[HONEY_KEY_SLASH], + action); + } + break; + case GLFW_KEY_0: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_0] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_0] = 0; } + if (honey_key_callbacks[HONEY_KEY_0] != NULL) { + honey_key_callbacks[HONEY_KEY_0] (honey_key_callbacks_data[HONEY_KEY_0], + action); + } + break; + case GLFW_KEY_1: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_1] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_1] = 0; } + if (honey_key_callbacks[HONEY_KEY_1] != NULL) { + honey_key_callbacks[HONEY_KEY_1] (honey_key_callbacks_data[HONEY_KEY_1], + action); + } + break; + case GLFW_KEY_2: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_2] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_2] = 0; } + if (honey_key_callbacks[HONEY_KEY_2] != NULL) { + honey_key_callbacks[HONEY_KEY_2] (honey_key_callbacks_data[HONEY_KEY_2], + action); + } + break; + case GLFW_KEY_3: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_3] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_3] = 0; } + if (honey_key_callbacks[HONEY_KEY_3] != NULL) { + honey_key_callbacks[HONEY_KEY_3] (honey_key_callbacks_data[HONEY_KEY_3], + action); + } + break; + case GLFW_KEY_4: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_4] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_4] = 0; } + if (honey_key_callbacks[HONEY_KEY_4] != NULL) { + honey_key_callbacks[HONEY_KEY_4] (honey_key_callbacks_data[HONEY_KEY_4], + action); + } + break; + case GLFW_KEY_5: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_5] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_5] = 0; } + if (honey_key_callbacks[HONEY_KEY_5] != NULL) { + honey_key_callbacks[HONEY_KEY_5] (honey_key_callbacks_data[HONEY_KEY_5], + action); + } + break; + case GLFW_KEY_6: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_6] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_6] = 0; } + if (honey_key_callbacks[HONEY_KEY_6] != NULL) { + honey_key_callbacks[HONEY_KEY_6] (honey_key_callbacks_data[HONEY_KEY_6], + action); + } + break; + case GLFW_KEY_7: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_7] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_7] = 0; } + if (honey_key_callbacks[HONEY_KEY_7] != NULL) { + honey_key_callbacks[HONEY_KEY_7] (honey_key_callbacks_data[HONEY_KEY_7], + action); + } + break; + case GLFW_KEY_8: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_8] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_8] = 0; } + if (honey_key_callbacks[HONEY_KEY_8] != NULL) { + honey_key_callbacks[HONEY_KEY_8] (honey_key_callbacks_data[HONEY_KEY_8], + action); + } + break; + case GLFW_KEY_9: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_9] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_9] = 0; } + if (honey_key_callbacks[HONEY_KEY_9] != NULL) { + honey_key_callbacks[HONEY_KEY_9] (honey_key_callbacks_data[HONEY_KEY_9], + action); + } + break; + case GLFW_KEY_SEMICOLON: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_SEMICOLON] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_SEMICOLON] = 0; } + if (honey_key_callbacks[HONEY_KEY_SEMICOLON] != NULL) { + honey_key_callbacks[HONEY_KEY_SEMICOLON] (honey_key_callbacks_data[HONEY_KEY_SEMICOLON], + action); + } + break; + case GLFW_KEY_EQUAL: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_EQUAL] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_EQUAL] = 0; } + if (honey_key_callbacks[HONEY_KEY_EQUAL] != NULL) { + honey_key_callbacks[HONEY_KEY_EQUAL] (honey_key_callbacks_data[HONEY_KEY_EQUAL], + action); + } + break; + case GLFW_KEY_A: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_A] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_A] = 0; } + if (honey_key_callbacks[HONEY_KEY_A] != NULL) { + honey_key_callbacks[HONEY_KEY_A] (honey_key_callbacks_data[HONEY_KEY_A], + action); + } + break; + case GLFW_KEY_B: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_B] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_B] = 0; } + if (honey_key_callbacks[HONEY_KEY_B] != NULL) { + honey_key_callbacks[HONEY_KEY_B] (honey_key_callbacks_data[HONEY_KEY_B], + action); + } + break; + case GLFW_KEY_C: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_C] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_C] = 0; } + if (honey_key_callbacks[HONEY_KEY_C] != NULL) { + honey_key_callbacks[HONEY_KEY_C] (honey_key_callbacks_data[HONEY_KEY_C], + action); + } + break; + case GLFW_KEY_D: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_D] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_D] = 0; } + if (honey_key_callbacks[HONEY_KEY_D] != NULL) { + honey_key_callbacks[HONEY_KEY_D] (honey_key_callbacks_data[HONEY_KEY_D], + action); + } + break; + case GLFW_KEY_E: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_E] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_E] = 0; } + if (honey_key_callbacks[HONEY_KEY_E] != NULL) { + honey_key_callbacks[HONEY_KEY_E] (honey_key_callbacks_data[HONEY_KEY_E], + action); + } + break; + case GLFW_KEY_F: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F] = 0; } + if (honey_key_callbacks[HONEY_KEY_F] != NULL) { + honey_key_callbacks[HONEY_KEY_F] (honey_key_callbacks_data[HONEY_KEY_F], + action); + } + break; + case GLFW_KEY_G: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_G] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_G] = 0; } + if (honey_key_callbacks[HONEY_KEY_G] != NULL) { + honey_key_callbacks[HONEY_KEY_G] (honey_key_callbacks_data[HONEY_KEY_G], + action); + } + break; + case GLFW_KEY_H: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_H] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_H] = 0; } + if (honey_key_callbacks[HONEY_KEY_H] != NULL) { + honey_key_callbacks[HONEY_KEY_H] (honey_key_callbacks_data[HONEY_KEY_H], + action); + } + break; + case GLFW_KEY_I: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_I] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_I] = 0; } + if (honey_key_callbacks[HONEY_KEY_I] != NULL) { + honey_key_callbacks[HONEY_KEY_I] (honey_key_callbacks_data[HONEY_KEY_I], + action); + } + break; + case GLFW_KEY_J: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_J] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_J] = 0; } + if (honey_key_callbacks[HONEY_KEY_J] != NULL) { + honey_key_callbacks[HONEY_KEY_J] (honey_key_callbacks_data[HONEY_KEY_J], + action); + } + break; + case GLFW_KEY_K: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_K] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_K] = 0; } + if (honey_key_callbacks[HONEY_KEY_K] != NULL) { + honey_key_callbacks[HONEY_KEY_K] (honey_key_callbacks_data[HONEY_KEY_K], + action); + } + break; + case GLFW_KEY_L: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_L] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_L] = 0; } + if (honey_key_callbacks[HONEY_KEY_L] != NULL) { + honey_key_callbacks[HONEY_KEY_L] (honey_key_callbacks_data[HONEY_KEY_L], + action); + } + break; + case GLFW_KEY_M: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_M] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_M] = 0; } + if (honey_key_callbacks[HONEY_KEY_M] != NULL) { + honey_key_callbacks[HONEY_KEY_M] (honey_key_callbacks_data[HONEY_KEY_M], + action); + } + break; + case GLFW_KEY_N: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_N] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_N] = 0; } + if (honey_key_callbacks[HONEY_KEY_N] != NULL) { + honey_key_callbacks[HONEY_KEY_N] (honey_key_callbacks_data[HONEY_KEY_N], + action); + } + break; + case GLFW_KEY_O: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_O] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_O] = 0; } + if (honey_key_callbacks[HONEY_KEY_O] != NULL) { + honey_key_callbacks[HONEY_KEY_O] (honey_key_callbacks_data[HONEY_KEY_O], + action); + } + break; + case GLFW_KEY_P: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_P] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_P] = 0; } + if (honey_key_callbacks[HONEY_KEY_P] != NULL) { + honey_key_callbacks[HONEY_KEY_P] (honey_key_callbacks_data[HONEY_KEY_P], + action); + } + break; + case GLFW_KEY_Q: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_Q] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_Q] = 0; } + if (honey_key_callbacks[HONEY_KEY_Q] != NULL) { + honey_key_callbacks[HONEY_KEY_Q] (honey_key_callbacks_data[HONEY_KEY_Q], + action); + } + break; + case GLFW_KEY_R: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_R] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_R] = 0; } + if (honey_key_callbacks[HONEY_KEY_R] != NULL) { + honey_key_callbacks[HONEY_KEY_R] (honey_key_callbacks_data[HONEY_KEY_R], + action); + } + break; + case GLFW_KEY_S: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_S] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_S] = 0; } + if (honey_key_callbacks[HONEY_KEY_S] != NULL) { + honey_key_callbacks[HONEY_KEY_S] (honey_key_callbacks_data[HONEY_KEY_S], + action); + } + break; + case GLFW_KEY_T: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_T] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_T] = 0; } + if (honey_key_callbacks[HONEY_KEY_T] != NULL) { + honey_key_callbacks[HONEY_KEY_T] (honey_key_callbacks_data[HONEY_KEY_T], + action); + } + break; + case GLFW_KEY_U: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_U] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_U] = 0; } + if (honey_key_callbacks[HONEY_KEY_U] != NULL) { + honey_key_callbacks[HONEY_KEY_U] (honey_key_callbacks_data[HONEY_KEY_U], + action); + } + break; + case GLFW_KEY_V: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_V] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_V] = 0; } + if (honey_key_callbacks[HONEY_KEY_V] != NULL) { + honey_key_callbacks[HONEY_KEY_V] (honey_key_callbacks_data[HONEY_KEY_V], + action); + } + break; + case GLFW_KEY_W: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_W] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_W] = 0; } + if (honey_key_callbacks[HONEY_KEY_W] != NULL) { + honey_key_callbacks[HONEY_KEY_W] (honey_key_callbacks_data[HONEY_KEY_W], + action); + } + break; + case GLFW_KEY_X: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_X] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_X] = 0; } + if (honey_key_callbacks[HONEY_KEY_X] != NULL) { + honey_key_callbacks[HONEY_KEY_X] (honey_key_callbacks_data[HONEY_KEY_X], + action); + } + break; + case GLFW_KEY_Y: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_Y] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_Y] = 0; } + if (honey_key_callbacks[HONEY_KEY_Y] != NULL) { + honey_key_callbacks[HONEY_KEY_Y] (honey_key_callbacks_data[HONEY_KEY_Y], + action); + } + break; + case GLFW_KEY_Z: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_Z] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_Z] = 0; } + if (honey_key_callbacks[HONEY_KEY_Z] != NULL) { + honey_key_callbacks[HONEY_KEY_Z] (honey_key_callbacks_data[HONEY_KEY_Z], + action); + } + break; + case GLFW_KEY_LEFT_BRACKET: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_LEFT_BRACKET] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_LEFT_BRACKET] = 0; } + if (honey_key_callbacks[HONEY_KEY_LEFT_BRACKET] != NULL) { + honey_key_callbacks[HONEY_KEY_LEFT_BRACKET] (honey_key_callbacks_data[HONEY_KEY_LEFT_BRACKET], + action); + } + break; + case GLFW_KEY_BACKSLASH: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_BACKSLASH] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_BACKSLASH] = 0; } + if (honey_key_callbacks[HONEY_KEY_BACKSLASH] != NULL) { + honey_key_callbacks[HONEY_KEY_BACKSLASH] (honey_key_callbacks_data[HONEY_KEY_BACKSLASH], + action); + } + break; + case GLFW_KEY_RIGHT_BRACKET: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_RIGHT_BRACKET] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_RIGHT_BRACKET] = 0; } + if (honey_key_callbacks[HONEY_KEY_RIGHT_BRACKET] != NULL) { + honey_key_callbacks[HONEY_KEY_RIGHT_BRACKET] (honey_key_callbacks_data[HONEY_KEY_RIGHT_BRACKET], + action); + } + break; + case GLFW_KEY_GRAVE_ACCENT: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_GRAVE_ACCENT] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_GRAVE_ACCENT] = 0; } + if (honey_key_callbacks[HONEY_KEY_GRAVE_ACCENT] != NULL) { + honey_key_callbacks[HONEY_KEY_GRAVE_ACCENT] (honey_key_callbacks_data[HONEY_KEY_GRAVE_ACCENT], + action); + } + break; + case GLFW_KEY_WORLD_1: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_WORLD_1] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_WORLD_1] = 0; } + if (honey_key_callbacks[HONEY_KEY_WORLD_1] != NULL) { + honey_key_callbacks[HONEY_KEY_WORLD_1] (honey_key_callbacks_data[HONEY_KEY_WORLD_1], + action); + } + break; + case GLFW_KEY_WORLD_2: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_WORLD_2] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_WORLD_2] = 0; } + if (honey_key_callbacks[HONEY_KEY_WORLD_2] != NULL) { + honey_key_callbacks[HONEY_KEY_WORLD_2] (honey_key_callbacks_data[HONEY_KEY_WORLD_2], + action); + } + break; + case GLFW_KEY_ESCAPE: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_ESCAPE] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_ESCAPE] = 0; } + if (honey_key_callbacks[HONEY_KEY_ESCAPE] != NULL) { + honey_key_callbacks[HONEY_KEY_ESCAPE] (honey_key_callbacks_data[HONEY_KEY_ESCAPE], + action); + } + break; + case GLFW_KEY_ENTER: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_ENTER] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_ENTER] = 0; } + if (honey_key_callbacks[HONEY_KEY_ENTER] != NULL) { + honey_key_callbacks[HONEY_KEY_ENTER] (honey_key_callbacks_data[HONEY_KEY_ENTER], + action); + } + break; + case GLFW_KEY_TAB: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_TAB] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_TAB] = 0; } + if (honey_key_callbacks[HONEY_KEY_TAB] != NULL) { + honey_key_callbacks[HONEY_KEY_TAB] (honey_key_callbacks_data[HONEY_KEY_TAB], + action); + } + break; + case GLFW_KEY_BACKSPACE: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_BACKSPACE] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_BACKSPACE] = 0; } + if (honey_key_callbacks[HONEY_KEY_BACKSPACE] != NULL) { + honey_key_callbacks[HONEY_KEY_BACKSPACE] (honey_key_callbacks_data[HONEY_KEY_BACKSPACE], + action); + } + break; + case GLFW_KEY_INSERT: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_INSERT] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_INSERT] = 0; } + if (honey_key_callbacks[HONEY_KEY_INSERT] != NULL) { + honey_key_callbacks[HONEY_KEY_INSERT] (honey_key_callbacks_data[HONEY_KEY_INSERT], + action); + } + break; + case GLFW_KEY_DELETE: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_DELETE] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_DELETE] = 0; } + if (honey_key_callbacks[HONEY_KEY_DELETE] != NULL) { + honey_key_callbacks[HONEY_KEY_DELETE] (honey_key_callbacks_data[HONEY_KEY_DELETE], + action); + } + break; + case GLFW_KEY_RIGHT: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_RIGHT] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_RIGHT] = 0; } + if (honey_key_callbacks[HONEY_KEY_RIGHT] != NULL) { + honey_key_callbacks[HONEY_KEY_RIGHT] (honey_key_callbacks_data[HONEY_KEY_RIGHT], + action); + } + break; + case GLFW_KEY_LEFT: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_LEFT] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_LEFT] = 0; } + if (honey_key_callbacks[HONEY_KEY_LEFT] != NULL) { + honey_key_callbacks[HONEY_KEY_LEFT] (honey_key_callbacks_data[HONEY_KEY_LEFT], + action); + } + break; + case GLFW_KEY_DOWN: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_DOWN] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_DOWN] = 0; } + if (honey_key_callbacks[HONEY_KEY_DOWN] != NULL) { + honey_key_callbacks[HONEY_KEY_DOWN] (honey_key_callbacks_data[HONEY_KEY_DOWN], + action); + } + break; + case GLFW_KEY_UP: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_UP] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_UP] = 0; } + if (honey_key_callbacks[HONEY_KEY_UP] != NULL) { + honey_key_callbacks[HONEY_KEY_UP] (honey_key_callbacks_data[HONEY_KEY_UP], + action); + } + break; + case GLFW_KEY_PAGE_UP: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_PAGE_UP] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_PAGE_UP] = 0; } + if (honey_key_callbacks[HONEY_KEY_PAGE_UP] != NULL) { + honey_key_callbacks[HONEY_KEY_PAGE_UP] (honey_key_callbacks_data[HONEY_KEY_PAGE_UP], + action); + } + break; + case GLFW_KEY_PAGE_DOWN: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_PAGE_DOWN] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_PAGE_DOWN] = 0; } + if (honey_key_callbacks[HONEY_KEY_PAGE_DOWN] != NULL) { + honey_key_callbacks[HONEY_KEY_PAGE_DOWN] (honey_key_callbacks_data[HONEY_KEY_PAGE_DOWN], + action); + } + break; + case GLFW_KEY_HOME: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_HOME] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_HOME] = 0; } + if (honey_key_callbacks[HONEY_KEY_HOME] != NULL) { + honey_key_callbacks[HONEY_KEY_HOME] (honey_key_callbacks_data[HONEY_KEY_HOME], + action); + } + break; + case GLFW_KEY_END: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_END] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_END] = 0; } + if (honey_key_callbacks[HONEY_KEY_END] != NULL) { + honey_key_callbacks[HONEY_KEY_END] (honey_key_callbacks_data[HONEY_KEY_END], + action); + } + break; + case GLFW_KEY_CAPS_LOCK: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_CAPS_LOCK] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_CAPS_LOCK] = 0; } + if (honey_key_callbacks[HONEY_KEY_CAPS_LOCK] != NULL) { + honey_key_callbacks[HONEY_KEY_CAPS_LOCK] (honey_key_callbacks_data[HONEY_KEY_CAPS_LOCK], + action); + } + break; + case GLFW_KEY_SCROLL_LOCK: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_SCROLL_LOCK] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_SCROLL_LOCK] = 0; } + if (honey_key_callbacks[HONEY_KEY_SCROLL_LOCK] != NULL) { + honey_key_callbacks[HONEY_KEY_SCROLL_LOCK] (honey_key_callbacks_data[HONEY_KEY_SCROLL_LOCK], + action); + } + break; + case GLFW_KEY_NUM_LOCK: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_NUM_LOCK] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_NUM_LOCK] = 0; } + if (honey_key_callbacks[HONEY_KEY_NUM_LOCK] != NULL) { + honey_key_callbacks[HONEY_KEY_NUM_LOCK] (honey_key_callbacks_data[HONEY_KEY_NUM_LOCK], + action); + } + break; + case GLFW_KEY_PRINT_SCREEN: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_PRINT_SCREEN] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_PRINT_SCREEN] = 0; } + if (honey_key_callbacks[HONEY_KEY_PRINT_SCREEN] != NULL) { + honey_key_callbacks[HONEY_KEY_PRINT_SCREEN] (honey_key_callbacks_data[HONEY_KEY_PRINT_SCREEN], + action); + } + break; + case GLFW_KEY_PAUSE: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_PAUSE] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_PAUSE] = 0; } + if (honey_key_callbacks[HONEY_KEY_PAUSE] != NULL) { + honey_key_callbacks[HONEY_KEY_PAUSE] (honey_key_callbacks_data[HONEY_KEY_PAUSE], + action); + } + break; + case GLFW_KEY_F1: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F1] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F1] = 0; } + if (honey_key_callbacks[HONEY_KEY_F1] != NULL) { + honey_key_callbacks[HONEY_KEY_F1] (honey_key_callbacks_data[HONEY_KEY_F1], + action); + } + break; + case GLFW_KEY_F2: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F2] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F2] = 0; } + if (honey_key_callbacks[HONEY_KEY_F2] != NULL) { + honey_key_callbacks[HONEY_KEY_F2] (honey_key_callbacks_data[HONEY_KEY_F2], + action); + } + break; + case GLFW_KEY_F3: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F3] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F3] = 0; } + if (honey_key_callbacks[HONEY_KEY_F3] != NULL) { + honey_key_callbacks[HONEY_KEY_F3] (honey_key_callbacks_data[HONEY_KEY_F3], + action); + } + break; + case GLFW_KEY_F4: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F4] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F4] = 0; } + if (honey_key_callbacks[HONEY_KEY_F4] != NULL) { + honey_key_callbacks[HONEY_KEY_F4] (honey_key_callbacks_data[HONEY_KEY_F4], + action); + } + break; + case GLFW_KEY_F5: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F5] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F5] = 0; } + if (honey_key_callbacks[HONEY_KEY_F5] != NULL) { + honey_key_callbacks[HONEY_KEY_F5] (honey_key_callbacks_data[HONEY_KEY_F5], + action); + } + break; + case GLFW_KEY_F6: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F6] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F6] = 0; } + if (honey_key_callbacks[HONEY_KEY_F6] != NULL) { + honey_key_callbacks[HONEY_KEY_F6] (honey_key_callbacks_data[HONEY_KEY_F6], + action); + } + break; + case GLFW_KEY_F7: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F7] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F7] = 0; } + if (honey_key_callbacks[HONEY_KEY_F7] != NULL) { + honey_key_callbacks[HONEY_KEY_F7] (honey_key_callbacks_data[HONEY_KEY_F7], + action); + } + break; + case GLFW_KEY_F8: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F8] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F8] = 0; } + if (honey_key_callbacks[HONEY_KEY_F8] != NULL) { + honey_key_callbacks[HONEY_KEY_F8] (honey_key_callbacks_data[HONEY_KEY_F8], + action); + } + break; + case GLFW_KEY_F9: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F9] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F9] = 0; } + if (honey_key_callbacks[HONEY_KEY_F9] != NULL) { + honey_key_callbacks[HONEY_KEY_F9] (honey_key_callbacks_data[HONEY_KEY_F9], + action); + } + break; + case GLFW_KEY_F10: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F10] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F10] = 0; } + if (honey_key_callbacks[HONEY_KEY_F10] != NULL) { + honey_key_callbacks[HONEY_KEY_F10] (honey_key_callbacks_data[HONEY_KEY_F10], + action); + } + break; + case GLFW_KEY_F11: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F11] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F11] = 0; } + if (honey_key_callbacks[HONEY_KEY_F11] != NULL) { + honey_key_callbacks[HONEY_KEY_F11] (honey_key_callbacks_data[HONEY_KEY_F11], + action); + } + break; + case GLFW_KEY_F12: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F12] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F12] = 0; } + if (honey_key_callbacks[HONEY_KEY_F12] != NULL) { + honey_key_callbacks[HONEY_KEY_F12] (honey_key_callbacks_data[HONEY_KEY_F12], + action); + } + break; + case GLFW_KEY_F13: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F13] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F13] = 0; } + if (honey_key_callbacks[HONEY_KEY_F13] != NULL) { + honey_key_callbacks[HONEY_KEY_F13] (honey_key_callbacks_data[HONEY_KEY_F13], + action); + } + break; + case GLFW_KEY_F14: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F14] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F14] = 0; } + if (honey_key_callbacks[HONEY_KEY_F14] != NULL) { + honey_key_callbacks[HONEY_KEY_F14] (honey_key_callbacks_data[HONEY_KEY_F14], + action); + } + break; + case GLFW_KEY_F15: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F15] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F15] = 0; } + if (honey_key_callbacks[HONEY_KEY_F15] != NULL) { + honey_key_callbacks[HONEY_KEY_F15] (honey_key_callbacks_data[HONEY_KEY_F15], + action); + } + break; + case GLFW_KEY_F16: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F16] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F16] = 0; } + if (honey_key_callbacks[HONEY_KEY_F16] != NULL) { + honey_key_callbacks[HONEY_KEY_F16] (honey_key_callbacks_data[HONEY_KEY_F16], + action); + } + break; + case GLFW_KEY_F17: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F17] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F17] = 0; } + if (honey_key_callbacks[HONEY_KEY_F17] != NULL) { + honey_key_callbacks[HONEY_KEY_F17] (honey_key_callbacks_data[HONEY_KEY_F17], + action); + } + break; + case GLFW_KEY_F18: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F18] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F18] = 0; } + if (honey_key_callbacks[HONEY_KEY_F18] != NULL) { + honey_key_callbacks[HONEY_KEY_F18] (honey_key_callbacks_data[HONEY_KEY_F18], + action); + } + break; + case GLFW_KEY_F19: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F19] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F19] = 0; } + if (honey_key_callbacks[HONEY_KEY_F19] != NULL) { + honey_key_callbacks[HONEY_KEY_F19] (honey_key_callbacks_data[HONEY_KEY_F19], + action); + } + break; + case GLFW_KEY_F20: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F20] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F20] = 0; } + if (honey_key_callbacks[HONEY_KEY_F20] != NULL) { + honey_key_callbacks[HONEY_KEY_F20] (honey_key_callbacks_data[HONEY_KEY_F20], + action); + } + break; + case GLFW_KEY_F21: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F21] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F21] = 0; } + if (honey_key_callbacks[HONEY_KEY_F21] != NULL) { + honey_key_callbacks[HONEY_KEY_F21] (honey_key_callbacks_data[HONEY_KEY_F21], + action); + } + break; + case GLFW_KEY_F22: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F22] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F22] = 0; } + if (honey_key_callbacks[HONEY_KEY_F22] != NULL) { + honey_key_callbacks[HONEY_KEY_F22] (honey_key_callbacks_data[HONEY_KEY_F22], + action); + } + break; + case GLFW_KEY_F23: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F23] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F23] = 0; } + if (honey_key_callbacks[HONEY_KEY_F23] != NULL) { + honey_key_callbacks[HONEY_KEY_F23] (honey_key_callbacks_data[HONEY_KEY_F23], + action); + } + break; + case GLFW_KEY_F24: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F24] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F24] = 0; } + if (honey_key_callbacks[HONEY_KEY_F24] != NULL) { + honey_key_callbacks[HONEY_KEY_F24] (honey_key_callbacks_data[HONEY_KEY_F24], + action); + } + break; + case GLFW_KEY_F25: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_F25] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_F25] = 0; } + if (honey_key_callbacks[HONEY_KEY_F25] != NULL) { + honey_key_callbacks[HONEY_KEY_F25] (honey_key_callbacks_data[HONEY_KEY_F25], + action); + } + break; + case GLFW_KEY_KP_0: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_0] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_0] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_0] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_0] (honey_key_callbacks_data[HONEY_KEY_KP_0], + action); + } + break; + case GLFW_KEY_KP_1: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_1] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_1] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_1] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_1] (honey_key_callbacks_data[HONEY_KEY_KP_1], + action); + } + break; + case GLFW_KEY_KP_2: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_2] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_2] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_2] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_2] (honey_key_callbacks_data[HONEY_KEY_KP_2], + action); + } + break; + case GLFW_KEY_KP_3: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_3] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_3] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_3] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_3] (honey_key_callbacks_data[HONEY_KEY_KP_3], + action); + } + break; + case GLFW_KEY_KP_4: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_4] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_4] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_4] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_4] (honey_key_callbacks_data[HONEY_KEY_KP_4], + action); + } + break; + case GLFW_KEY_KP_5: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_5] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_5] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_5] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_5] (honey_key_callbacks_data[HONEY_KEY_KP_5], + action); + } + break; + case GLFW_KEY_KP_6: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_6] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_6] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_6] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_6] (honey_key_callbacks_data[HONEY_KEY_KP_6], + action); + } + break; + case GLFW_KEY_KP_7: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_7] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_7] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_7] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_7] (honey_key_callbacks_data[HONEY_KEY_KP_7], + action); + } + break; + case GLFW_KEY_KP_8: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_8] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_8] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_8] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_8] (honey_key_callbacks_data[HONEY_KEY_KP_8], + action); + } + break; + case GLFW_KEY_KP_9: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_9] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_9] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_9] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_9] (honey_key_callbacks_data[HONEY_KEY_KP_9], + action); + } + break; + case GLFW_KEY_KP_DECIMAL: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_DECIMAL] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_DECIMAL] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_DECIMAL] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_DECIMAL] (honey_key_callbacks_data[HONEY_KEY_KP_DECIMAL], + action); + } + break; + case GLFW_KEY_KP_DIVIDE: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_DIVIDE] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_DIVIDE] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_DIVIDE] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_DIVIDE] (honey_key_callbacks_data[HONEY_KEY_KP_DIVIDE], + action); + } + break; + case GLFW_KEY_KP_MULTIPLY: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_MULTIPLY] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_MULTIPLY] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_MULTIPLY] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_MULTIPLY] (honey_key_callbacks_data[HONEY_KEY_KP_MULTIPLY], + action); + } + break; + case GLFW_KEY_KP_SUBTRACT: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_SUBTRACT] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_SUBTRACT] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_SUBTRACT] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_SUBTRACT] (honey_key_callbacks_data[HONEY_KEY_KP_SUBTRACT], + action); + } + break; + case GLFW_KEY_KP_ADD: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_ADD] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_ADD] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_ADD] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_ADD] (honey_key_callbacks_data[HONEY_KEY_KP_ADD], + action); + } + break; + case GLFW_KEY_KP_ENTER: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_ENTER] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_ENTER] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_ENTER] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_ENTER] (honey_key_callbacks_data[HONEY_KEY_KP_ENTER], + action); + } + break; + case GLFW_KEY_KP_EQUAL: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_KP_EQUAL] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_KP_EQUAL] = 0; } + if (honey_key_callbacks[HONEY_KEY_KP_EQUAL] != NULL) { + honey_key_callbacks[HONEY_KEY_KP_EQUAL] (honey_key_callbacks_data[HONEY_KEY_KP_EQUAL], + action); + } + break; + case GLFW_KEY_LEFT_SHIFT: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_LEFT_SHIFT] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_LEFT_SHIFT] = 0; } + if (honey_key_callbacks[HONEY_KEY_LEFT_SHIFT] != NULL) { + honey_key_callbacks[HONEY_KEY_LEFT_SHIFT] (honey_key_callbacks_data[HONEY_KEY_LEFT_SHIFT], + action); + } + break; + case GLFW_KEY_LEFT_CONTROL: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_LEFT_CONTROL] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_LEFT_CONTROL] = 0; } + if (honey_key_callbacks[HONEY_KEY_LEFT_CONTROL] != NULL) { + honey_key_callbacks[HONEY_KEY_LEFT_CONTROL] (honey_key_callbacks_data[HONEY_KEY_LEFT_CONTROL], + action); + } + break; + case GLFW_KEY_LEFT_ALT: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_LEFT_ALT] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_LEFT_ALT] = 0; } + if (honey_key_callbacks[HONEY_KEY_LEFT_ALT] != NULL) { + honey_key_callbacks[HONEY_KEY_LEFT_ALT] (honey_key_callbacks_data[HONEY_KEY_LEFT_ALT], + action); + } + break; + case GLFW_KEY_LEFT_SUPER: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_LEFT_SUPER] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_LEFT_SUPER] = 0; } + if (honey_key_callbacks[HONEY_KEY_LEFT_SUPER] != NULL) { + honey_key_callbacks[HONEY_KEY_LEFT_SUPER] (honey_key_callbacks_data[HONEY_KEY_LEFT_SUPER], + action); + } + break; + case GLFW_KEY_RIGHT_SHIFT: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_RIGHT_SHIFT] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_RIGHT_SHIFT] = 0; } + if (honey_key_callbacks[HONEY_KEY_RIGHT_SHIFT] != NULL) { + honey_key_callbacks[HONEY_KEY_RIGHT_SHIFT] (honey_key_callbacks_data[HONEY_KEY_RIGHT_SHIFT], + action); + } + break; + case GLFW_KEY_RIGHT_CONTROL: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_RIGHT_CONTROL] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_RIGHT_CONTROL] = 0; } + if (honey_key_callbacks[HONEY_KEY_RIGHT_CONTROL] != NULL) { + honey_key_callbacks[HONEY_KEY_RIGHT_CONTROL] (honey_key_callbacks_data[HONEY_KEY_RIGHT_CONTROL], + action); + } + break; + case GLFW_KEY_RIGHT_ALT: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_RIGHT_ALT] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_RIGHT_ALT] = 0; } + if (honey_key_callbacks[HONEY_KEY_RIGHT_ALT] != NULL) { + honey_key_callbacks[HONEY_KEY_RIGHT_ALT] (honey_key_callbacks_data[HONEY_KEY_RIGHT_ALT], + action); + } + break; + case GLFW_KEY_RIGHT_SUPER: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_RIGHT_SUPER] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_RIGHT_SUPER] = 0; } + if (honey_key_callbacks[HONEY_KEY_RIGHT_SUPER] != NULL) { + honey_key_callbacks[HONEY_KEY_RIGHT_SUPER] (honey_key_callbacks_data[HONEY_KEY_RIGHT_SUPER], + action); + } + break; + case GLFW_KEY_MENU: + if (action == HONEY_PRESS_KEY) { honey_key_states[HONEY_KEY_MENU] = 1; } + if (action == HONEY_RELEASE_KEY) { honey_key_states[HONEY_KEY_MENU] = 0; } + if (honey_key_callbacks[HONEY_KEY_MENU] != NULL) { + honey_key_callbacks[HONEY_KEY_MENU] (honey_key_callbacks_data[HONEY_KEY_MENU], + action); + } + break; + default: + /* do nothing */ + break; + } +} + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -- cgit v1.2.1