-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
58 lines (39 loc) · 908 Bytes
/
main.cpp
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "camera.hpp"
#include "player.hpp"
#include "raylib.h"
#include <raymath.h>
#define WIDTH 100
#define HEIGHT 100
#if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h>
#endif
static void UpdateDrawFrame(void);
Player *player;
Image imageBuffer;
Texture textureBuffer;
int main() {
const int screenWidth = WIDTH;
const int screenHeight = HEIGHT;
SetTraceLogLevel(LOG_WARNING);
InitWindow(screenWidth * SCALE, screenHeight * SCALE, "[FoxEngine]");
DisableCursor();
player = new Player(WIDTH, HEIGHT);
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 60, 1);
#else
SetTargetFPS(60 / SPEED);
while (!WindowShouldClose()) {
UpdateDrawFrame();
}
#endif
CloseWindow();
return 0;
}
static void UpdateDrawFrame(void) {
player->Update();
player->Draw();
BeginDrawing();
ClearBackground(RED);
DrawFPS(10, 10);
EndDrawing();
}