update timer
This commit is contained in:
+9
-2
@@ -18,8 +18,8 @@ TimerFired :: struct {
|
|||||||
|
|
||||||
// timers stay in a package global for now, deliberately outside the
|
// 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
|
// 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
|
// per-world to hang them on yet. same goes for the signal buses in their
|
||||||
// (wip) tween queue in their own files
|
// own file
|
||||||
@(private)
|
@(private)
|
||||||
timers: map[string]Timer
|
timers: map[string]Timer
|
||||||
|
|
||||||
@@ -34,6 +34,13 @@ start_timer :: proc(time: f32, signal: string) {
|
|||||||
timers[signal] = new_timer
|
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
|
// 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
|
// expired timer is reset to Timer{} too, so lifetime != 0 means "still
|
||||||
// ticking" and lifetime <= 0 means "done (or never started)"
|
// ticking" and lifetime <= 0 means "done (or never started)"
|
||||||
|
|||||||
Reference in New Issue
Block a user