From eb495f67c270069790446e584686a9b159968410 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Thu, 17 Sep 2026 21:26:19 +0200 Subject: [PATCH] Random stuff --- game/game.odin | 9 ++++----- src/event/event.odin | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/game/game.odin b/game/game.odin index bcdabe9..af67f1d 100644 --- a/game/game.odin +++ b/game/game.odin @@ -9,7 +9,7 @@ import "sindri:core" // ----------------------------------------- Game_Memory :: struct { - should_close: bool + should_close: bool, } g: ^Game_Memory @@ -61,6 +61,7 @@ init :: proc() { fmt.println("hello from .dll!") g = new(Game_Memory) + memory_set(g) } @(export) @@ -90,12 +91,10 @@ should_close :: proc() -> bool { @(export) force_reload :: proc() -> bool { - // TODO: read keypress - return false + return input.key_state(.Key_F5) == .Press } @(export) force_restart :: proc() -> bool { - // TODO: read keypress - return false + return input.key_state(.Key_F6) == .Press } diff --git a/src/event/event.odin b/src/event/event.odin index bda2c35..512fbb8 100644 --- a/src/event/event.odin +++ b/src/event/event.odin @@ -5,9 +5,11 @@ import "core:fmt" import "sindri:input" // ----------------------------------------- +// Types // event category, bitfield (?) +// Event_Data :: union { Event :: union { Window_Close_Event, Window_Resize_Event, @@ -22,6 +24,11 @@ Event :: union { Mouse_Scroll_Event, } +// Event :: struct { +// data: Event_Data, +// handled: bool, +// } + Window_Close_Event :: struct { handled: bool, } @@ -85,6 +92,13 @@ Mouse_Scroll_Event :: struct { } // ----------------------------------------- +// Variables + +// I want to have a list of Listeners per Event type, but this is state +// listeners: map[typeid][dynamic]Listener + +// ----------------------------------------- +// Public functions // Dispatcher(Event) -> forwards to the right function on_event :: proc(event: Event) { @@ -116,3 +130,9 @@ on_event :: proc(event: Event) { fmt.println("Joy dis:", e.id) } } + +/* + Notes: + + Have the events queued up into a frame buffer that gets drained at a specific time. + */