summaryrefslogtreecommitdiff
path: root/src/honey.c
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2020-10-18 12:10:48 -0500
committersanine-a <sanine.not@pm.me>2020-10-18 12:10:48 -0500
commit225167461d754b476b4fcc7726c492cc972ca654 (patch)
treed0a8060fe28a94b6fb24c002aa9744706e496b18 /src/honey.c
parent1bc1f216e5682cd7918240f37f3709b642e08e2b (diff)
clear out old files, add basic scripting
Diffstat (limited to 'src/honey.c')
-rw-r--r--src/honey.c69
1 files changed, 0 insertions, 69 deletions
diff --git a/src/honey.c b/src/honey.c
deleted file mode 100644
index d5b3cd7..0000000
--- a/src/honey.c
+++ /dev/null
@@ -1,69 +0,0 @@
-#include "include/honey.h"
-
-static void default_honey_update_callback(float dt) {}
-static void default_honey_draw_callback() {}
-
-honey_window honey_setup(int screen_width, int screen_height, char* window_title) {
- honey_update_callback = &default_honey_update_callback;
- honey_draw_callback = &default_honey_draw_callback;
-
- 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;
- }
-
- honey_setup_keyboard();
- glfwSetKeyCallback(window, default_honey_keyboard_callback);
-
- // Enable blending
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- return window;
-}
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-
-void honey_set_update_callback(void (*update_callback)(float)) {
- honey_update_callback = update_callback;
-}
-
-void honey_set_draw_callback(void (*draw_callback)()) {
- honey_draw_callback = draw_callback;
-}
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-
-void honey_run(honey_window window) {
- float prevTime = 0;
- float currentTime = 0;
- float dt;
- float draw_dt = 0;
-
- while(!glfwWindowShouldClose(window)) {
- currentTime = (float) glfwGetTime();
- dt = currentTime - prevTime;
- prevTime = currentTime;
-
- honey_update_callback(dt);
- honey_draw_callback();
- }
-}
-
-