diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/include/engine/core/platform.h | 11 | ||||
| -rw-r--r-- | src/core/src/loop.c | 11 | ||||
| -rw-r--r-- | src/ctrl/include/engine/ctrl/input.h | 8 |
3 files changed, 7 insertions, 23 deletions
diff --git a/src/core/include/engine/core/platform.h b/src/core/include/engine/core/platform.h index 7faf901..0a1bb45 100644 --- a/src/core/include/engine/core/platform.h +++ b/src/core/include/engine/core/platform.h @@ -28,17 +28,8 @@ typedef struct Instance { u64 frame; u16 fps_target; - /* TODO: Move mouse data to input ctx/bindings */ /* TODO: Move input ctx/bindings to window */ /* TODO: Move cam to window->renderer */ - ivec2 mouse_pos; - - ivec2 mousedown; - ivec2 mouseup; - - bool mouse_lclick; - bool mouse_rclick; - Camera *cam; /* Global resources that live from engine_init to engine_free */ @@ -47,9 +38,9 @@ typedef struct Instance { memory* mem; /* The ctrl is probably the only sensible thing in this struct. */ - i_ctx** bindings; usize bindings_sz; usize bindings_len; + i_ctx** bindings; binding_t bindings_global[NUM_GLOBAL_BINDINGS]; } Instance; diff --git a/src/core/src/loop.c b/src/core/src/loop.c index a17f540..56567f6 100644 --- a/src/core/src/loop.c +++ b/src/core/src/loop.c @@ -132,17 +132,6 @@ Instance* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight p->mem = memory_new(initial_memory); - /* Getting the mouse coords now resolves the issue where a click "isn't - * registered" when the mouse isn't moved before the user clicks */ - - p->mousedown[0] = -1; - p->mousedown[1] = -1; - p->mouseup[0] = -1; - p->mouseup[1] = -1; - - p->mouse_lclick = false; - p->mouse_rclick = false; - p->bindings = NULL; p->bindings_sz = 0; p->bindings_len = 0; diff --git a/src/ctrl/include/engine/ctrl/input.h b/src/ctrl/include/engine/ctrl/input.h index 8ed77b4..18a6797 100644 --- a/src/ctrl/include/engine/ctrl/input.h +++ b/src/ctrl/include/engine/ctrl/input.h @@ -5,8 +5,8 @@ extern "C" { #endif +#include <cglm/ivec2.h> #include <engine/core/types.h> -//#include <engine/ctrl/scancodes.h> #include <engine/ctrl/keycodes.h> typedef void input_callback_t(void*); @@ -49,8 +49,12 @@ typedef struct binding_t { } binding_t; typedef struct i_ctx { - binding_t* bindings; + + // Current mouse position + ivec2 mouse_pos; + usize len; + binding_t* bindings; } i_ctx; void i_ctx_t_free(i_ctx* c); |
