Initialize SDL
This commit is contained in:
2
.bazelrc
2
.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
|
||||
|
10
game/BUILD.bazel
Normal file
10
game/BUILD.bazel
Normal file
@ -0,0 +1,10 @@
|
||||
cc_binary(
|
||||
name = "game",
|
||||
srcs = [
|
||||
"main.cpp",
|
||||
],
|
||||
deps = [
|
||||
"@asl//asl",
|
||||
"@sdl3_windows//:sdl3",
|
||||
],
|
||||
)
|
33
game/main.cpp
Normal file
33
game/main.cpp
Normal file
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user