summaryrefslogtreecommitdiffhomepage
path: root/main.cpp
blob: 9f216e5a05d527d01e832dddfb6c9b6eead4efd5 (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
#include <memory>

#include <raylib.h>

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

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


static Game s_game;


void Loop();


int main()
{
    InitWindow(800, 600, "Bullet Hell 2022");
    s_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()
{
    s_game.update(GetFrameTime());
    BeginDrawing();
    s_game.draw();
    EndDrawing();
}