move some stuff into the vulkan backend

This commit is contained in:
jacekpoz 2024-10-04 16:22:25 +02:00
parent eb3a3680df
commit 63b841fe63
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8
2 changed files with 11 additions and 11 deletions

View file

@ -18,12 +18,6 @@
#include <stdlib.h>
#include <string.h>
static void mouse_button_callback(GLFWwindow *window, int button, int action, int mods) {
double x, y;
glfwGetCursorPos(window, &x, &y);
vk_handle_mouse_button_input((PtkPos){ .x = x, .y = y }, button, action, mods);
}
PTK_OPTION_DEFINE(PtkLogLevel);
PTK_OPTION(PtkLogLevel) get_log_level(void) {
@ -98,11 +92,6 @@ bool ptk_init(const size_t width, const size_t height, const char *title, const
return false;
}
glfwSetFramebufferSizeCallback(window, vk_framebuffer_resized);
glfwSetMouseButtonCallback(window, mouse_button_callback);
vk_init_vertices();
// on tiling desktops (most standalone X11 WMs / Wayland compositors)
// the size of the window won't necessarily be what the user set due to tiling
// so we do this ugly workaround where we fetch the size again

View file

@ -174,11 +174,22 @@ bool vk_update_uniform_buffer(const size_t current_frame) {
return true;
}
static void mouse_button_callback(GLFWwindow *window, int button, int action, int mods) {
double x, y;
glfwGetCursorPos(window, &x, &y);
vk_handle_mouse_button_input((PtkPos){ .x = x, .y = y }, button, action, mods);
}
bool vk_init(GLFWwindow *window, const size_t width, const size_t height, const char *title, const PtkVersion version) {
m_window = window;
m_uniform_buffer_object.initial_window_size.w = width;
m_uniform_buffer_object.initial_window_size.h = height;
vk_init_vertices();
glfwSetFramebufferSizeCallback(window, vk_framebuffer_resized);
glfwSetMouseButtonCallback(window, mouse_button_callback);
PTK_OPTION(VkInstance) instance_opt = vk_instance_create(title, version, m_validation_layers);
if (!instance_opt.exists) {