Fumofumotris/source/fumoengine/include/event.h

26 lines
441 B
C
Raw Normal View History

2024-04-03 23:31:47 +00:00
#pragma once
#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-08 12:47:46 +00:00
typedef void (*handler)(void *state, void *instance);
2024-05-07 03:29:10 +00:00
2024-05-07 22:10:15 +00:00
struct Method {
2024-05-08 12:47:46 +00:00
handler callback;
2024-05-07 22:10:15 +00:00
void *instance;
};
2024-04-22 22:13:13 +00:00
struct Event {
2024-05-07 22:10:15 +00:00
struct Method *methods;
2024-05-07 03:29:10 +00:00
usize len;
usize capacity;
2024-04-03 23:31:47 +00:00
};
2024-04-22 22:13:13 +00:00
2024-05-08 12:47:46 +00:00
bool CreateEvent(struct Event *event);
2024-04-03 23:31:47 +00:00
2024-05-08 12:47:46 +00:00
bool EventAdd(struct Event *event, handler callback, void *instance);
2024-04-03 23:31:47 +00:00
2024-05-08 12:47:46 +00:00
void EventInvoke(struct Event *event, void *state);