Fumofumotris/source/fumoengine/fumoengine.c

33 lines
620 B
C
Raw Normal View History

2024-05-02 22:17:37 +00:00
#include "fumoengine.h"
#include "platform.h"
2024-04-30 21:41:31 +00:00
2024-03-25 05:34:59 +00:00
2024-05-06 05:52:30 +00:00
void Panic(char *message)
2024-04-19 20:23:11 +00:00
{
printf(message);
exit(1);
}
2024-05-07 03:29:10 +00:00
void InvokeUpdate(void_func func, void *arg)
{
struct { nsec frametime; } *args = arg;
((update_func)func)(args->frametime);
}
2024-05-02 22:17:37 +00:00
bool FumoInit(struct FumoGame *game)
2024-04-09 07:00:48 +00:00
{
2024-04-19 20:23:11 +00:00
if (!PlatformInit())
2024-05-06 05:52:30 +00:00
Panic("Platform failed to initialize");
2024-04-19 20:23:11 +00:00
2024-05-02 22:17:37 +00:00
if (!CreateController(&game->ctrl))
2024-05-06 05:52:30 +00:00
Panic("Out of memory");
2024-04-03 23:31:47 +00:00
2024-05-02 22:17:37 +00:00
if (!CreateEvent(&game->update))
2024-05-06 05:52:30 +00:00
Panic("Out of memory");
2024-04-22 22:13:13 +00:00
2024-05-02 22:17:37 +00:00
if (!BeginInputThread(&game->input_hand))
2024-05-06 05:52:30 +00:00
Panic("Input handle failed to initialize");
2024-04-03 23:31:47 +00:00
2024-03-25 05:34:59 +00:00
return 0;
}