#include "log.h" #include "vulkan.h" #include #include #include struct cat_GLFW { GLFWwindow *window; struct Vk *vk; }; VkSurfaceKHR create_glfw_surface(void *data, VkInstance instance) { struct cat_GLFW *state = data; VkSurfaceKHR surface; meow("%d", glfwCreateWindowSurface(instance, state->window, NULL, &surface)); meow("created a surface at %p", surface); return surface; } struct cat_GLFW *cat_init_glfw(const char *name, int width, int heigh, struct Vk **vk) { glfwInit(); glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); struct cat_GLFW *state = malloc(sizeof(struct cat_GLFW)); state->window = glfwCreateWindow(width, heigh, "meooow", NULL, NULL); state->vk = init_vk(state, 500, 500, create_glfw_surface); *vk = state->vk; return state; } void cat_glfw_draw(struct cat_GLFW *state) { glfwPollEvents(); vk_draw(state->vk); } void cat_uninit_glfw(struct cat_GLFW *state) { glfwDestroyWindow(state->window); glfwTerminate(); } bool cat_glfw_should_close(struct cat_GLFW *state) { return false; }