summaryrefslogtreecommitdiff
path: root/src/window.c
blob: 4a498e6c64408cf75f55a0110966030b447c221e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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;
}