Initial simple event manager.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package game
|
||||
|
||||
// all possible game events
|
||||
Event_Type :: enum {
|
||||
Game_Over,
|
||||
Score_Change,
|
||||
Ball_Collision,
|
||||
}
|
||||
|
||||
// optional details attached to an event
|
||||
Event :: struct {
|
||||
type: Event_Type,
|
||||
winner_is_player: bool,
|
||||
}
|
||||
|
||||
// global event storage
|
||||
GLOBAL_EVENTS: [dynamic]Event
|
||||
|
||||
emit_event :: proc(event: Event) {
|
||||
append(&GLOBAL_EVENTS, event)
|
||||
}
|
||||
|
||||
flush_events :: proc() {
|
||||
clear(&GLOBAL_EVENTS)
|
||||
}
|
||||
Reference in New Issue
Block a user