-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
79 lines (63 loc) · 1.78 KB
/
main.cpp
File metadata and controls
79 lines (63 loc) · 1.78 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "raylib.h"
// #include "./src/ECS.h"
#include "Game.h"
#include <iostream>
#include <string>
// #define PLATFORM_WEB
#if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h>
#endif
#ifdef _WIN32
#ifdef __cplusplus
extern "C"
{
#endif
__declspec(dllexport) unsigned long NvOptimusEnablement = 1;
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
#ifdef __cplusplus
}
#endif
#endif
void UpdateDrawFrame();
const int screenWidth = 960;
const int screenHeight = 540;
Game game;
bool isFirstFrame = true;
int main()
{ // Create game object, scene object. Game contains scene. Scene contains ecs, physManager and performs run/update functions
// Initialization
//--------------------------------------------------------------------------------------
SetConfigFlags(FLAG_MSAA_4X_HINT);
SetConfigFlags(FLAG_WINDOW_RESIZABLE | FLAG_VSYNC_HINT);
InitWindow(screenWidth, screenHeight, "Izzy's Game");
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Game game;
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
UpdateDrawFrame();
}
#endif
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
void UpdateDrawFrame()
{
if (isFirstFrame)
{
game.Init();
isFirstFrame = false;
}
else
{
game.Run();
}
// game.Run();
}