-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
40 lines (29 loc) · 1.17 KB
/
main.cpp
File metadata and controls
40 lines (29 loc) · 1.17 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
#include "engine/engine.hpp"
#include "editor/editor.hpp"
#include "game/game.hpp"
int main(int argc, char** argv){
bool runEditor = false;
if(argc > 1 && std::string(argv[1]) == "--editor") runEditor = true;
// Engine engine(1920, 1140);
Engine engine(1920, 1000);
SceneManager sceneManager;
GameCallbacks callbacks;
const char* vendor = (const char*)glGetString(GL_VENDOR);
const char* renderer = (const char*)glGetString(GL_RENDERER);
printf("GL_VENDOR: %s\nGL_RENDERER: %s\n", vendor, renderer);
if(runEditor){
Editor editor(engine, sceneManager);
callbacks.onInit = [&]() {editor.init();};
callbacks.onUpdate = [&](float dt) {editor.update(dt);};
callbacks.onRender = [&]() {editor.render();};
callbacks.onShutdown = [&]() {editor.shutdown();};
}else{
Game game(engine);
callbacks.onInit = [&]() {game.init();};
callbacks.onUpdate = [&](float dt) {game.update(dt);};
callbacks.onRender = [&]() {game.render();};
callbacks.onShutdown = [&]() {game.shutdown();};
}
engine.run(callbacks);
return 0;
}