Update for web
This commit is contained in:
parent
dcb479912f
commit
45422940ad
@ -12,7 +12,7 @@ Tree::Tree(int size)
|
||||
start.x = size / 2;
|
||||
start.y = size;
|
||||
|
||||
branches.assign(11, {0});
|
||||
branches.assign(11, {});
|
||||
}
|
||||
|
||||
Tree::~Tree()
|
||||
|
28
src/main.cpp
28
src/main.cpp
@ -1,6 +1,20 @@
|
||||
#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";
|
||||
@ -14,17 +28,19 @@ int main(void)
|
||||
#else
|
||||
InitWindow(screenWidth, screenHeight, name);
|
||||
#endif
|
||||
SetTargetFPS(60);
|
||||
|
||||
App app;
|
||||
app.init(screenWidth, screenHeight);
|
||||
|
||||
#if defined(PLATFORM_WEB)
|
||||
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
|
||||
#else
|
||||
SetTargetFPS(60);
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
app.update();
|
||||
BeginDrawing();
|
||||
app.draw();
|
||||
EndDrawing();
|
||||
UpdateDrawFrame();
|
||||
}
|
||||
#endif
|
||||
|
||||
app.deinit();
|
||||
|
||||
CloseWindow();
|
||||
|
Loading…
x
Reference in New Issue
Block a user