treender/src/main.cpp
2024-06-07 23:42:18 +02:00

48 lines
756 B
C++

#include <raylib.h>
#include "App.hpp"
#if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h>
#endif
static App app;
void UpdateDrawFrame()
{
app.update();
BeginDrawing();
app.draw();
EndDrawing();
}
int main(void)
{
char name[] = "treender";
int screenWidth = 600;
int screenHeight = 800;
#ifdef PLATFORM_ANDROID
InitWindow(0, 0, name);
screenWidth = GetScreenWidth();
screenHeight = GetScreenHeight();
#else
InitWindow(screenWidth, screenHeight, name);
#endif
app.init(screenWidth, screenHeight);
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
SetTargetFPS(60);
while (!WindowShouldClose())
{
UpdateDrawFrame();
}
#endif
app.deinit();
CloseWindow();
return 0;
}