summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-10-31 13:15:37 -0400
committerFreya Murphy <freya@freyacat.org>2025-10-31 13:28:29 -0400
commit4d9044c6596cdf99d323c4dd1fcdf0e0d7c8549a (patch)
tree1fe4a53f449e692727cfc5bd584e31801dd3b297
parentdungeon: remove unused rand_chacha (diff)
downloadDungeonCrawl-4d9044c6596cdf99d323c4dd1fcdf0e0d7c8549a.tar.gz
DungeonCrawl-4d9044c6596cdf99d323c4dd1fcdf0e0d7c8549a.tar.bz2
DungeonCrawl-4d9044c6596cdf99d323c4dd1fcdf0e0d7c8549a.zip
Add SDL feature flag (fixes wayland issues)
-rw-r--r--flake.nix42
-rw-r--r--game/Cargo.toml1
-rw-r--r--graphics/Cargo.toml3
3 files changed, 30 insertions, 16 deletions
diff --git a/flake.nix b/flake.nix
index 88d1256..eca8545 100644
--- a/flake.nix
+++ b/flake.nix
@@ -30,26 +30,38 @@
xorg.libXinerama
xorg.libXcursor
xorg.libXi
+ SDL2
];
- libPath = lib.makeLibraryPath libs;
in {
devShell =
pkgs.mkShell
{
- packages = with pkgs; [
- # rust
- rustc
- rustfmt
- rust-analyzer
- cargo
- clippy
- # raylib
- cmake
- clang
- glfw
- pkg-config
- ] ++ libs;
- LD_LIBRARY_PATH = libPath;
+ packages = with pkgs;
+ [
+ # rust
+ rustc
+ rustfmt
+ rust-analyzer
+ cargo
+ clippy
+ # raylib
+ cmake
+ clang
+ glfw
+ pkg-config
+ ]
+ ++ libs;
+
+ shellHook = ''
+ # Set SDL video driver
+ if [ "$XDG_SESSION_TYPE" == "wayland" ]; then
+ export SDL_VIDEODRIVER=wayland
+ else
+ export SDL_VIDEODRIVER=x11
+ fi
+ '';
+
+ LD_LIBRARY_PATH = lib.makeLibraryPath libs;
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
};
diff --git a/game/Cargo.toml b/game/Cargo.toml
index d3084d4..2cfa795 100644
--- a/game/Cargo.toml
+++ b/game/Cargo.toml
@@ -18,3 +18,4 @@ workspace = true
default = ["debug"]
debug = ["graphics/debug"]
wayland = ["graphics/wayland"]
+sdl = ["graphics/sdl"]
diff --git a/graphics/Cargo.toml b/graphics/Cargo.toml
index 8f16f71..050c314 100644
--- a/graphics/Cargo.toml
+++ b/graphics/Cargo.toml
@@ -17,4 +17,5 @@ workspace = true
[features]
default = []
debug = []
-wayland = ["raylib/wayland"]
+wayland = ["sdl", "raylib/wayland"]
+sdl = ["raylib/sdl"]