Fumofumotris/source/game/event.h
Julia 8ad3bf1f22 gaming
th j
2024-04-22 17:13:13 -05:00

28 lines
524 B
C

#pragma once
#include <iso646.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "fumotris.h"
#include "gametime.h"
union func {
void (*generic)(void *arg);
void (*update)(Time dt);
};
struct Event {
union func *clbks;
size_t len;
size_t capacity;
};
bool CreateEvent(struct Event *event);
bool EventSubscribe(struct Event *event, union func callback);
void EventInvoke(struct Event *event, void *arg);
void EventInvokeUpdate(struct Event *event, Time dt);