summaryrefslogtreecommitdiff
path: root/src/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core.c b/src/core.c
index 210c282..9359a6b 100644
--- a/src/core.c
+++ b/src/core.c
@@ -2,6 +2,7 @@
#include <celeritas.h>
#include <stdlib.h>
+#include "glfw3.h"
NAMESPACED_LOGGER(core);
@@ -15,6 +16,7 @@ static const char* gapi = "Vulkan";
// forward declares
void key_callback(GLFWwindow* win, int key, int scancode, int action, int mods);
+void resize_callback(GLFWwindow* win, int width, int height);
void core_bringup(const char* window_name, struct GLFWwindow* optional_window) {
INFO("Initiate Core bringup");
@@ -22,6 +24,8 @@ void core_bringup(const char* window_name, struct GLFWwindow* optional_window) {
INFO("Create GLFW window");
glfwInit();
+ glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
+
char* full_window_name = malloc(sizeof(char) * 100);
int _offset = sprintf(full_window_name, "%s (%s)", window_name, gapi);
@@ -32,6 +36,7 @@ void core_bringup(const char* window_name, struct GLFWwindow* optional_window) {
ral_backend_init(window_name, glfw_window);
glfwSetKeyCallback(glfw_window, key_callback);
+ glfwSetFramebufferSizeCallback(glfw_window, resize_callback);
}
void core_shutdown() {
ral_backend_shutdown();
@@ -46,4 +51,8 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod
if (key == GLFW_KEY_ESCAPE && action == GLFW_RELEASE) {
g_core.should_exit = true;
}
+}
+
+void resize_callback(GLFWwindow* window, int width, int height) {
+ ral_backend_resize_framebuffer(width, height);
} \ No newline at end of file