summaryrefslogtreecommitdiff
path: root/src/honey_setup.c
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2020-05-20 20:51:05 -0500
committersanine-a <sanine.not@pm.me>2020-05-20 20:51:05 -0500
commit040ba6826237eb124aaa4576fc302e2e07dd40c5 (patch)
treec35f1c3c4a63f307ac8a0f6beac346e3d08b6b7d /src/honey_setup.c
parent447c3de585cca51013b17017d968e3aee53f5c87 (diff)
add honey_mesh and assorted related functions
Diffstat (limited to 'src/honey_setup.c')
-rw-r--r--src/honey_setup.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/honey_setup.c b/src/honey_setup.c
new file mode 100644
index 0000000..247c325
--- /dev/null
+++ b/src/honey_setup.c
@@ -0,0 +1,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;
+}
+
+