summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2025-01-20 22:32:30 +0100
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2025-01-20 22:32:30 +0100
commitb438dd7bf4082e2b6a23e3995d5c249b33102abc (patch)
treec5dcafbf50782d0919cf4610f568832b90ce1436
parente60c508e976ff8acb71a2fd0fc6958c5f1f50a69 (diff)
Initialize SDL
-rw-r--r--.bazelrc2
-rw-r--r--game/BUILD.bazel10
-rw-r--r--game/main.cpp33
3 files changed, 45 insertions, 0 deletions
diff --git a/.bazelrc b/.bazelrc
index 2a72692..b8d70bc 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -9,6 +9,8 @@ build:windows --cxxopt=-Xclang=-std=c++20
common --incompatible_autoload_externally=+@rules_python
+build --features=external_include_paths
+
build --cxxopt=-Wall
build --cxxopt=-Wno-c++98-compat
build --cxxopt=-Wno-c++98-compat-pedantic
diff --git a/game/BUILD.bazel b/game/BUILD.bazel
new file mode 100644
index 0000000..753a77a
--- /dev/null
+++ b/game/BUILD.bazel
@@ -0,0 +1,10 @@
+cc_binary(
+ name = "game",
+ srcs = [
+ "main.cpp",
+ ],
+ deps = [
+ "@asl//asl",
+ "@sdl3_windows//:sdl3",
+ ],
+)
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 <asl/print.hpp>
+
+#include <SDL3/SDL.h>
+#include <SDL3/SDL_main.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);
+
+ 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;
+}
+