From 4749e1a01e989999eef9f4131cf2edf6e3211ebc Mon Sep 17 00:00:00 2001 From: sanine-a Date: Fri, 23 Oct 2020 21:52:10 -0500 Subject: add key binding input functions --- src/input/input.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/input/input.h') diff --git a/src/input/input.h b/src/input/input.h index 31be34a..2127417 100644 --- a/src/input/input.h +++ b/src/input/input.h @@ -136,9 +136,8 @@ #define HONEY_KEY_RELEASE 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); +static int honey_key_callbacks[HONEY_N_KEYS]; +static int honey_key_callbacks_data[HONEY_N_KEYS]; /** @brief Initializes Honey's internal keyboard states. * @@ -176,7 +175,7 @@ int honey_key_down(lua_State* L); * @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); +int honey_key_bind(lua_State* L); /** @brief Unbind a key callback. * @@ -184,13 +183,13 @@ void honey_key_bind(int key, void (*callback)(void*, int), void* data); * * @param[in] key The key to unbind a callback from. */ -void honey_key_unbind(int key); +int honey_key_unbind(lua_State* L); /** @brief Unbind all key callbacks. * * THIS FUNCTION DOES NOT FREE MEMORY! If you allocated any, be sure to free it yourself! */ -void honey_key_unbind_all(); +int honey_key_unbind_all(lua_State* L); void default_honey_keyboard_callback(honey_window window, int key, int scancode, int action, int mods); -- cgit v1.2.1