Fixed window resizing

This commit is contained in:
Piotr Krygier committed 2025-06-20 13:44:33 +02:00
1 parent f197280e88
commit 3c72c9b387
6 files changed
+61 -17

No files matched your search

+25
View File
@@ -10,14 +10,19 @@
*/
#include "window.h"
#include <stdint.h>
#include "GLFW/glfw3.h"
#include "locale_window.h"
#include "rse_window_errors.h"
#include "src/vulkan_commons.h"
#include "utilities/logger.h"
#include "utilities/rse_errors_common.h"
#include "vulkan/vulkan_core.h"
#include "vulkan_base.h"
GLFWwindow *g_window_handle = NULL;
uint8_t g_is_frambuffer_resized = 0U;
/**
* @brief GLFW error callback
@@ -51,6 +56,14 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
}
}
static void framebuffer_resized_callback(GLFWwindow* window, int width, int height)
{
(void)window;
(void)width;
(void)height;
g_is_frambuffer_resized = 1;
}
rse_err_t window_init()
{
@@ -82,6 +95,7 @@ rse_err_t window_init()
}
glfwSetKeyCallback(g_window_handle, key_callback);
glfwSetFramebufferSizeCallback(g_window_handle, framebuffer_resized_callback);
return RSE_ERROR_NO_ERROR;
}
@@ -93,6 +107,7 @@ rse_err_t window_loop()
draw_frame();
}
vkDeviceWaitIdle(g_vulkan_state.device);
return RSE_ERROR_NO_ERROR;
}
@@ -107,3 +122,13 @@ GLFWwindow* get_window_handle()
{
return g_window_handle;
}
uint8_t is_framebuffer_resized()
{
return g_is_frambuffer_resized;
}
void reset_framebuffer_resized()
{
g_is_frambuffer_resized = 0U;
}