2024-05-02 22:17:37 +00:00
|
|
|
#pragma once
|
|
|
|
#include "ctrl.h"
|
|
|
|
#include "event.h"
|
|
|
|
#include "fumocommon.h"
|
|
|
|
#include "input.h"
|
2024-05-07 22:10:15 +00:00
|
|
|
#include "vector.h"
|
2024-05-02 22:17:37 +00:00
|
|
|
|
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
typedef nsec (*coroutine_handler)(void *state, void *instance);
|
|
|
|
|
|
|
|
|
|
|
|
struct Coroutine {
|
|
|
|
coroutine_handler callback;
|
|
|
|
void *state;
|
|
|
|
nsec next_scheduled;
|
2024-05-15 05:44:13 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
struct Instance {
|
2024-05-02 22:17:37 +00:00
|
|
|
struct Controller ctrl;
|
|
|
|
struct InputHandle input_hand;
|
|
|
|
|
2024-05-07 22:10:15 +00:00
|
|
|
struct Event on_start;
|
|
|
|
struct Event on_update;
|
2024-05-15 05:44:13 +00:00
|
|
|
struct Event on_draw;
|
|
|
|
|
|
|
|
struct Vector coroutines;
|
2024-05-02 22:17:37 +00:00
|
|
|
|
2024-05-07 03:29:10 +00:00
|
|
|
nsec time;
|
2024-05-07 22:10:15 +00:00
|
|
|
nsec frametime;
|
2024-05-02 22:17:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2024-05-06 05:52:30 +00:00
|
|
|
void Panic(char *message);
|
2024-05-02 22:17:37 +00:00
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
bool CoroutineAdd(struct Instance *inst, void *state, coroutine_handler callback);
|
|
|
|
|
|
|
|
void CoroutineTryInvoke(struct Instance *inst, struct Coroutine *co);
|
|
|
|
|
|
|
|
bool CreateFumoInstance(struct Instance *game);
|
2024-05-02 22:17:37 +00:00
|
|
|
|
2024-05-15 22:10:47 +00:00
|
|
|
bool FumoInstanceRun(struct Instance *game);
|