Files
hk21/game/main.cpp

61 lines
1.5 KiB
C++

#include <asl/print.hpp>
#include <asl/buffer.hpp>
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <SDL3/SDL_vulkan.h>
#define VK_NO_STDDEF_H
#define VK_NO_STDINT_H
#define VK_NO_PROTOTYPES
#include <vulkan.h>
int SDL_main(int /* argc */, char* /* argv */[])
{
SDL_Init(SDL_INIT_VIDEO);
SDL_Window* window = SDL_CreateWindow("HK-21 - 460nm", 1280, 720, SDL_WINDOW_VULKAN);
SDL_ShowWindow(window);
asl::buffer<const char*> instance_extensions;
asl::buffer<const char*> device_extensions;
asl::buffer<const char*> layers;
{
uint32_t count = 0;
const char* const* extensions = SDL_Vulkan_GetInstanceExtensions(&count);
for (uint32_t i = 0; i < count; ++i)
{
instance_extensions.push(extensions[i]); // NOLINT(*-pointer-arithmetic)
}
}
layers.push("VK_LAYER_KHRONOS_validation");
layers.push("VK_LAYER_LUNARG_monitor");
instance_extensions.push(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
device_extensions.push(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
bool running = true;
while (running)
{
SDL_Event e;
while (SDL_PollEvent(&e))
{
if (e.type == SDL_EVENT_QUIT || (e.type == SDL_EVENT_KEY_DOWN && e.key.key == SDLK_ESCAPE))
{
running = false;
}
}
SDL_Delay(16);
}
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}