blob: 247c3257dc6f557acdd7d4572bb6006f95f1d73e (
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
|
#include "include/honey.h"
honey_window honey_setup(int screen_width, int screen_height, char* window_title) {
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
honey_window window = glfwCreateWindow(screen_width, screen_height, window_title, NULL, NULL);
if (window == NULL) {
fprintf(stderr, "ERROR: failed to create window!\n");
glfwTerminate();
return NULL;
}
glfwMakeContextCurrent(window);
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress)) {
fprintf(stderr, "ERROR: failed to initialize GLAD!\n");
glfwTerminate();
return NULL;
}
return window;
}
|