Fumofumotris/source/fumoengine/include/event.h

28 lines
505 B
C
Raw Normal View History

2024-04-03 23:31:47 +00:00
#pragma once
#include <iso646.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
2024-04-30 21:41:31 +00:00
#include "fumocommon.h"
2024-04-03 23:31:47 +00:00
2024-04-22 22:13:13 +00:00
union func {
void (*generic)(void *arg);
void (*update)(Time dt);
};
struct Event {
union func *clbks;
2024-04-03 23:31:47 +00:00
size_t len;
size_t capacity;
};
2024-04-22 22:13:13 +00:00
bool CreateEvent(struct Event *event);
bool EventSubscribe(struct Event *event, union func callback);
2024-04-03 23:31:47 +00:00
2024-04-22 22:13:13 +00:00
void EventInvoke(struct Event *event, void *arg);
2024-04-03 23:31:47 +00:00
2024-04-22 22:13:13 +00:00
void EventInvokeUpdate(struct Event *event, Time dt);