summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c36
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;
+}