blob: 42b3b7a551e2368940f680d18c416c1928c60ed6 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright 2025 Steven Le Rouzic
//
// SPDX-License-Identifier: BSD-3-Clause
#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 = std::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;
}
|