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-05-07 03:29:10 +00:00
|
|
|
typedef void (*void_func)(void *arg);
|
|
|
|
|
|
|
|
typedef void (*invoker_func)(void_func func, void *arg);
|
|
|
|
|
2024-04-22 22:13:13 +00:00
|
|
|
|
|
|
|
struct Event {
|
2024-05-07 03:29:10 +00:00
|
|
|
void_func *callbacks;
|
|
|
|
usize len;
|
|
|
|
usize capacity;
|
2024-04-03 23:31:47 +00:00
|
|
|
};
|
|
|
|
|
2024-04-22 22:13:13 +00:00
|
|
|
|
2024-05-07 03:29:10 +00:00
|
|
|
bool CreateEvent(struct Event *event);
|
2024-04-03 23:31:47 +00:00
|
|
|
|
2024-05-07 03:29:10 +00:00
|
|
|
bool EventRegister(struct Event *event, void_func callback);
|
2024-04-03 23:31:47 +00:00
|
|
|
|
2024-05-07 03:29:10 +00:00
|
|
|
void EventInvoke(struct Event *event, void *args);
|