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.x = size / 2;
|
||||||
start.y = size;
|
start.y = size;
|
||||||
|
|
||||||
branches.assign(11, {0});
|
branches.assign(11, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
Tree::~Tree()
|
Tree::~Tree()
|
||||||
|
28
src/main.cpp
28
src/main.cpp
@ -1,6 +1,20 @@
|
|||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
#include "App.hpp"
|
#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)
|
int main(void)
|
||||||
{
|
{
|
||||||
char name[] = "treender";
|
char name[] = "treender";
|
||||||
@ -14,17 +28,19 @@ int main(void)
|
|||||||
#else
|
#else
|
||||||
InitWindow(screenWidth, screenHeight, name);
|
InitWindow(screenWidth, screenHeight, name);
|
||||||
#endif
|
#endif
|
||||||
SetTargetFPS(60);
|
|
||||||
|
|
||||||
App app;
|
|
||||||
app.init(screenWidth, screenHeight);
|
app.init(screenWidth, screenHeight);
|
||||||
|
|
||||||
|
#if defined(PLATFORM_WEB)
|
||||||
|
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
|
||||||
|
#else
|
||||||
|
SetTargetFPS(60);
|
||||||
while (!WindowShouldClose())
|
while (!WindowShouldClose())
|
||||||
{
|
{
|
||||||
app.update();
|
UpdateDrawFrame();
|
||||||
BeginDrawing();
|
|
||||||
app.draw();
|
|
||||||
EndDrawing();
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
app.deinit();
|
app.deinit();
|
||||||
|
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user