-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
48 lines (37 loc) · 1.5 KB
/
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
//
// Created by Conni Bilham on 10/07/2023.
//
#include "Storage.h"
#include "external/glad/include/glad/glad.h"
#include "external/glfw/include/GLFW/glfw3.h"
#include <iostream>
#include "include/Window.h"
#include "Scenes/main_scene.h"
#include "Scenes/orth_scene.h"
#include "Scenes/star_viewer.h"
#include "include/Vector.h"
Storage *storage;
#define T_STR(v) std::to_string(storage->version.v)
#define BUILD_STRING T_STR(major) + "." + T_STR(minor) + "." + T_STR(patch) + " Build " + T_STR(build)
int main() {
storage = new Storage();
if (!glfwInit()) {
logging::error("Failed to initialize GLFW");
return -1;
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);// For Mac OS X
storage->window.title = "Engine " + BUILD_STRING;
storage->scene_list.emplace_back(new main_scene());
storage->scene_list.emplace_back(new star_viewer());
storage->scene_list.emplace_back(new orth_scene());
auto camera = new Camera(glm::vec3(0.0f, 0.0f, 3.0f));
storage->window.width = 800;
storage->window.height = 600;
auto main_window = new Window(storage->window.width, storage->window.height, storage->window.title, storage->window.fullscreen, camera);
main_window->set_camera(camera);
main_window->window_size_callback(nullptr, storage->window.width, storage->window.height);
return 0;
}