summaryrefslogtreecommitdiffhomepage
path: root/main.cpp
blob: 207e86135ee5ad23f5388ee41ceb05af2f1431d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <memory>

#include <raylib.h>

#ifdef PLATFORM_WEB
#include <emscripten/emscripten.h>
#endif

#include "Game.h"
#include "Globals.h"
#include "TitleScreen.h"


Game g_game;


void Loop();


int main()
{
    InitWindow(800, 600, "Bullet Hell 2022");
    g_game.set(std::make_unique<TitleScreen>());
#ifdef PLATFORM_WEB
    emscripten_set_main_loop(Loop, 0, 1);
#else
    SetTargetFPS(60);
    while (!WindowShouldClose())
        Loop();
#endif  // PLATFORM_WEB
    CloseWindow();
}


void Loop()
{
    g_game.update(GetFrameTime());
    BeginDrawing();
    g_game.draw();
    EndDrawing();
}