From 24f19171fd9a801742155633bbac71c05ccf9d9a Mon Sep 17 00:00:00 2001 From: wooshings Date: Wed, 28 Oct 2026 23:16:14 -0700 Subject: [PATCH] update timer --- src/timer.odin | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/timer.odin b/src/timer.odin index c76ceb4..b4961ba 100644 --- a/src/timer.odin +++ b/src/timer.odin @@ -18,8 +18,8 @@ TimerFired :: struct { // timers stay in a package global for now, deliberately outside the // World: they're keyed by name, not owned by an entity, so there's nothing -// per-world to hang them on yet. same goes for the signal buses and the -// (wip) tween queue in their own files +// per-world to hang them on yet. same goes for the signal buses in their +// own file @(private) timers: map[string]Timer @@ -34,6 +34,13 @@ start_timer :: proc(time: f32, signal: string) { timers[signal] = new_timer } +// remove the timer stored under this name entirely, freeing its map entry. +// safe to call for a name that isn't running (no-op). this is for releasing +// timers you created, not for reading them out -- use get_timer for that +stop_timer :: proc(signal: string) { + delete_key(&timers, signal) +} + // the timer stored under this name, or a zero Timer if there is none. an // expired timer is reset to Timer{} too, so lifetime != 0 means "still // ticking" and lifetime <= 0 means "done (or never started)"