Files
hk21/hk21/game/main.cpp
2025-02-17 23:41:53 +01:00

48 lines
1000 B
C++

#include <asl/logging/logging.hpp>
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include "hk21/game/gpu.hpp"
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);
auto gpu_opt = gpu::init(window);
if (!gpu_opt.ok())
{
ASL_LOG_ERROR("Couldn't initialize GPU: {}", gpu_opt);
return 1;
}
auto gpu = ASL_MOVE(gpu_opt).value();
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;
}
}
gpu->frame();
SDL_Delay(16);
}
gpu->destroy();
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}