First commit

This commit is contained in:
2025-11-17 03:42:30 -05:00
commit d0f9669b8b
41 changed files with 36106 additions and 0 deletions

38
src/main.cpp Normal file
View File

@@ -0,0 +1,38 @@
#include <cstdlib>
#ifdef __EMSCRIPTEN__
#include <emscripten/emscripten.h>
#endif
#include "loader.h"
#include "state.h"
using namespace game;
#ifdef __EMSCRIPTEN__
static void emscripten_loop(void* arg)
{
auto* state = (State*)(arg);
state->loop();
if (!state->isRunning) emscripten_cancel_main_loop();
}
#endif
int main()
{
Loader loader;
if (loader.isError) return EXIT_FAILURE;
State state(loader.window, loader.context, Loader::SIZE);
#ifdef __EMSCRIPTEN__
emscripten_set_main_loop_arg(emscripten_loop, &state, 0, true);
#else
while (state.isRunning)
state.loop();
#endif
return EXIT_SUCCESS;
}