diff --git a/src/ptk.c b/src/ptk.c index bf03b96..f924e02 100644 --- a/src/ptk.c +++ b/src/ptk.c @@ -24,11 +24,6 @@ // TODO: clean up globals here -static void framebuffer_resize_callback(GLFWwindow *window, int width, int height) { - (void)window; (void)width; (void)height; - g_framebuffer_resized = true; -} - static void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods) { (void)window; (void)scancode; (void)action; (void)mods; if (key == GLFW_KEY_SPACE) { @@ -119,7 +114,7 @@ bool ptk_init(const size_t width, const size_t height, const char *title, const return false; } - glfwSetFramebufferSizeCallback(g_window, framebuffer_resize_callback); + glfwSetFramebufferSizeCallback(g_window, vk_framebuffer_resized); glfwSetKeyCallback(g_window, key_callback); glfwSetMouseButtonCallback(g_window, mouse_button_callback); diff --git a/src/ptk_vk/draw.c b/src/ptk_vk/draw.c index efc6459..ec2187c 100644 --- a/src/ptk_vk/draw.c +++ b/src/ptk_vk/draw.c @@ -13,9 +13,14 @@ // TODO: clean up globals here -bool g_framebuffer_resized = false; +bool m_framebuffer_resized = false; uint32_t g_current_frame = 0; +void vk_framebuffer_resized(GLFWwindow *window, int width, int height) { + (void)window; (void)width; (void)height; + m_framebuffer_resized = true; +} + bool vk_draw_frame(void) { vkWaitForFences(g_dev, 1, &g_in_flight_fences.data[g_current_frame], VK_TRUE, UINT64_MAX); @@ -84,9 +89,9 @@ bool vk_draw_frame(void) { if ( queue_present_result == VK_ERROR_OUT_OF_DATE_KHR || queue_present_result == VK_SUBOPTIMAL_KHR || - g_framebuffer_resized + m_framebuffer_resized ) { - g_framebuffer_resized = false; + m_framebuffer_resized = false; if (!vk_recreate_swapchain(g_window, g_physical_dev, g_surface, g_render_pass)) { return false; } diff --git a/src/ptk_vk/draw.h b/src/ptk_vk/draw.h index 2caacfa..554cf55 100644 --- a/src/ptk_vk/draw.h +++ b/src/ptk_vk/draw.h @@ -11,9 +11,10 @@ #endif #include -extern bool g_framebuffer_resized; extern uint32_t g_current_frame; +void vk_framebuffer_resized(GLFWwindow *window, int width, int height); + bool vk_draw_frame(void); #endif // PTK_PTK_VK_DRAW_H_