diff options
author | kartofen <mladenovnasko0@gmail.com> | 2023-10-16 23:46:15 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2023-10-16 23:46:15 +0300 |
commit | 5e910c7e41d18dab95e34ceb6e620a8958197ae6 (patch) | |
tree | bf49c8ca6dd123d0765beef63d5858445dcf24aa /src/window.c |
things done
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/window.c b/src/window.c new file mode 100644 index 0000000..4a498e6 --- /dev/null +++ b/src/window.c @@ -0,0 +1,36 @@ +#include "window.h" +#include "common.h" + +window_t window_create(struct window_info *info) +{ + info->flags |= SDL_WINDOW_SHOWN | SDL_WINDOW_VULKAN; + SDL_Vulkan_LoadLibrary(NULL); + + window_t window = SDL_CreateWindow(info->title, info->x, info->y, + info->w, info->h, info->flags); + return window; +} + +void window_destroy(window_t window) +{ + SDL_DestroyWindow((SDL_Window *)window); + SDL_Vulkan_UnloadLibrary(); +} + +int window_extension_info(window_t window, unsigned int *ext_count, const char **extensions) +{ + if(SDL_Vulkan_GetInstanceExtensions((SDL_Window *)window, ext_count, extensions) == SDL_FALSE) { + return 1; + } + + return 0; +} + +int window_create_surface(window_t window, VkInstance instance, VkSurfaceKHR *surface) +{ + if(SDL_Vulkan_CreateSurface((SDL_Window *)window, instance, surface) == SDL_FALSE) { + return 1; + } + + return 0; +} |