From b438dd7bf4082e2b6a23e3995d5c249b33102abc Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Mon, 20 Jan 2025 22:32:30 +0100 Subject: Initialize SDL --- game/main.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 game/main.cpp (limited to 'game/main.cpp') diff --git a/game/main.cpp b/game/main.cpp new file mode 100644 index 0000000..46f08f0 --- /dev/null +++ b/game/main.cpp @@ -0,0 +1,33 @@ +#include + +#include +#include + +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); + + 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; +} + -- cgit