From f9236e418228a0c855fd1b5a2c815da5ff13aa14 Mon Sep 17 00:00:00 2001 From: Sara Date: Sun, 16 Jul 2023 00:38:36 +0200 Subject: [PATCH] moved definitions of INPUT_LISTENER_TYPE_T and input_listener_t to input.c --- src/corelib/input.c | 28 ++++++++++++++++++++++++++++ src/corelib/input.h | 28 ---------------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/corelib/input.c b/src/corelib/input.c index fd1e771..ab769cc 100644 --- a/src/corelib/input.c +++ b/src/corelib/input.c @@ -6,6 +6,34 @@ #include "SDL2/SDL_render.h" #include +enum INPUT_LISTENER_TYPE_T { + INPUT_LISTENER_MOUSE, + INPUT_LISTENER_AXIS, + INPUT_LISTENER_SCROLL, + INPUT_LISTENER_BUTTON, +}; + +typedef struct input_listener_t { + enum INPUT_LISTENER_TYPE_T type; + union { + struct { + input_axis_fn delegate; + SDL_Scancode positive, negative; + int last_positive, last_negative; + } axis; + struct { + input_mouse_fn delegate; + } mouse; + struct { + input_button_fn delegate; + uint32_t button; + int last; + } button; + struct { + input_scroll_fn delegate; + } scroll; + }; +} input_listener_t; const Uint8* g_key_states = NULL; input_listener_t g_key_listeners[24]; diff --git a/src/corelib/input.h b/src/corelib/input.h index aadc16c..3cca76d 100644 --- a/src/corelib/input.h +++ b/src/corelib/input.h @@ -7,34 +7,6 @@ extern "C" { #include "SDL2/SDL.h" -enum INPUT_LISTENER_TYPE_T { - INPUT_LISTENER_MOUSE, - INPUT_LISTENER_AXIS, - INPUT_LISTENER_SCROLL, - INPUT_LISTENER_BUTTON, -}; - -typedef struct input_listener_t { - enum INPUT_LISTENER_TYPE_T type; - union { - struct { - input_axis_delegate_t delegate; - SDL_Scancode positive, negative; - int last_positive, last_negative; - } axis; - struct { - input_mouse_delegate_t delegate; - } mouse; - struct { - input_button_delegate_t delegate; - uint32_t button; - int last; - } button; - struct { - input_scroll_delegate_t delegate; - } scroll; - }; -} input_listener_t; typedef void(*input_axis_fn)(int value); typedef void(*input_mouse_fn)(float dx, float dy); typedef void(*input_button_fn)(int down);