-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstel.cpp
More file actions
44 lines (38 loc) · 850 Bytes
/
Copy pathconstel.cpp
File metadata and controls
44 lines (38 loc) · 850 Bytes
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
#include <memory>
#include <string>
#include <stdlib.h>
#include <time.h>
#include <GLFW/glfw3.h>
#include "common.hpp"
#include "graphics.hpp"
#include "input.hpp"
#include "world.hpp"
void exit_finalize(int code)
{
finalize_graphics();
finalize_world();
exit(code);
}
int main(int argc, char **argv)
{
time_t seed = time(NULL);
//printf("Random seed: 0x%lx\n", seed);
srand(seed);
std::string config_file;
if (argc >= 2)
config_file = argv[1];
config.load(config_file);
init_world();
GLFWwindow* window = init_graphics();
if (!window)
exit_finalize(1);
input.initialize(window);
// Main loop
while (!glfwWindowShouldClose(window)) {
double time = frame_sleep();
input.frame();
world_frame(time);
draw();
}
exit_finalize(0);
}