summaryrefslogtreecommitdiff
path: root/src/platform_glfw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform_glfw.c')
-rw-r--r--src/platform_glfw.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/platform_glfw.c b/src/platform_glfw.c
index 33614ff..ea743b5 100644
--- a/src/platform_glfw.c
+++ b/src/platform_glfw.c
@@ -11,6 +11,7 @@
#include <daw/logging.h>
+#include <daw/daw.h>
#include <daw/window.h>
static void window_resize_callback(GLFWwindow *restrict window, int width, int height);
@@ -20,7 +21,7 @@ static void render_init_opengl(Window *restrict w, const u32 flags);
void window_size_glfw(GLFWwindow *restrict w, ivec2 *restrict dst);
-Window* window_init_glfw(const char *restrict windowtitle, ivec2 windowsize, const u32 flags) {
+Window* window_init_glfw(Instance *restrict instance, const char *restrict windowtitle, ivec2 windowsize, const u32 flags) {
Window* ret = NULL;
GLFWwindow* window = NULL;
@@ -104,7 +105,7 @@ Window* window_init_glfw(const char *restrict windowtitle, ivec2 windowsize, con
}
// TODO: set this to `ret` once all the garbage is moved to `struct Window`
- glfwSetWindowUserPointer(window, (void*)ret);
+ glfwSetWindowUserPointer(window, (void*)instance);
render_init_opengl(ret, flags);
@@ -147,7 +148,8 @@ void window_poll_glfw(void) {
// Helper function implementations
static void window_resize_callback(GLFWwindow* window, int width, int height) {
(void)width; (void)height;
- Window* w = glfwGetWindowUserPointer(window);
+ Instance* i = glfwGetWindowUserPointer(window);
+ Window* w = i->window;
glfwSwapBuffers(window);
if (w != NULL) {
const GladGLContext* gl = w->context;
@@ -157,7 +159,8 @@ static void window_resize_callback(GLFWwindow* window, int width, int height) {
}
static void framebuffer_resize_callback(GLFWwindow* window, int width, int height) {
- Window* w = glfwGetWindowUserPointer(window);
+ Instance* i = glfwGetWindowUserPointer(window);
+ Window* w = i->window;
if (w != NULL) {
const GladGLContext* gl = w->context;
//TODO: Move the camera to window->renderer
@@ -166,7 +169,7 @@ static void framebuffer_resize_callback(GLFWwindow* window, int width, int heigh
w->windowsize[0] = width;
w->windowsize[1] = height;
- window_reset_cameras(w, w->render_targets);
+ window_reset_cameras(w, i->mem->data, w->render_targets);
//r_reset_camera(c);
}
DEBUG("FRAMEBUFFER RESIZE <%d,%d>\n", width, height);