blob: 94061f1261fff21f154f71e2fe10ba18682b3511 (
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 <iostream>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include "Game.hpp"
#include "Render.hpp"
#include "ThreadRole.hpp"
#include "World/World.hpp"
int main() {
HELLO_I_AM(MC::ThreadRole::Logic);
if (!glfwInit()) {
std::cout << "Failed to initialize GLFW" << std::endl;
return 1;
}
try {
MC::GFX::Window window(APP_NAME, WINDOW_WIDTH, WINDOW_HEIGHT);
window.detach();
auto render_control = std::make_shared<MC::Render::Control>();
std::thread render_thread{[&window, render_control] {
MC::Render render{window, render_control};
render.run();
}};
render_thread.detach();
MC::Game game{window, render_control};
game.run();
} catch (std::runtime_error& error) {
std::cout << "An error occurred: " << error.what() << std::endl;
glfwTerminate();
return 1;
}
glfwTerminate();
return 0;
}
|