summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-11-10 15:05:45 -0500
committerFreya Murphy <freya@freyacat.org>2025-11-10 15:05:45 -0500
commitcaefd6a78323379cdd39339a4e792a19f0a494f0 (patch)
tree441984c300b1dd81ff40365386b20b5a3dec8bf7
parentdungeon: new_unchecked should be unsafe (diff)
downloadDungeonCrawl-caefd6a78323379cdd39339a4e792a19f0a494f0.tar.gz
DungeonCrawl-caefd6a78323379cdd39339a4e792a19f0a494f0.tar.bz2
DungeonCrawl-caefd6a78323379cdd39339a4e792a19f0a494f0.zip
graphics: decouple sdl & wayland
-rw-r--r--dungeon/src/pos.rs12
-rw-r--r--flake.nix2
-rw-r--r--graphics/Cargo.toml2
-rw-r--r--graphics/src/lib.rs9
4 files changed, 18 insertions, 7 deletions
diff --git a/dungeon/src/pos.rs b/dungeon/src/pos.rs
index 8d84d3f..e3365ef 100644
--- a/dungeon/src/pos.rs
+++ b/dungeon/src/pos.rs
@@ -135,12 +135,12 @@ impl Pos {
/// let pos = unsafe { Pos::new_unchecked(1, 1) };
/// assert_eq!(pos.xy(), (1,1));
/// ```
- ///
- /// # Safety
- ///
- /// Library code and crates that use it expect the `Pos` x and y positions
- /// to be within a gurenteed bound. When they are not this can cause
- /// undefined behaviour, or crashes.
+ ///
+ /// # Safety
+ ///
+ /// Library code and crates that use it expect the `Pos` x and y positions
+ /// to be within a gurenteed bound. When they are not this can cause
+ /// undefined behaviour, or crashes.
#[must_use]
pub const unsafe fn new_unchecked(x: u16, y: u16) -> Self {
Self(x, y)
diff --git a/flake.nix b/flake.nix
index 494ab3e..47900be 100644
--- a/flake.nix
+++ b/flake.nix
@@ -26,10 +26,12 @@
alsa-lib
pulseaudio
wayland
+ wayland-scanner
xorg.libXrandr
xorg.libXinerama
xorg.libXcursor
xorg.libXi
+ libxkbcommon
SDL2
];
in {
diff --git a/graphics/Cargo.toml b/graphics/Cargo.toml
index 6f3be4e..bfc5554 100644
--- a/graphics/Cargo.toml
+++ b/graphics/Cargo.toml
@@ -16,5 +16,5 @@ workspace = true
[features]
default = []
-wayland = ["sdl", "raylib/wayland"]
+wayland = ["raylib/GLFW_BUILD_WAYLAND", "raylib/wayland"]
sdl = ["raylib/sdl"]
diff --git a/graphics/src/lib.rs b/graphics/src/lib.rs
index 811494c..25b4287 100644
--- a/graphics/src/lib.rs
+++ b/graphics/src/lib.rs
@@ -84,6 +84,15 @@ impl<'a> WindowBuilder<'a> {
builder.log_level(TraceLogLevel::LOG_WARNING);
}
+ // Set highdpi for wayland (this is only an issue for glfw)
+ // Rust binding to not make this accessable
+ #[cfg(feature = "wayland")]
+ #[cfg(not(feature = "sdl"))]
+ unsafe {
+ use ffi::ConfigFlags::*;
+ ffi::SetConfigFlags(FLAG_WINDOW_HIGHDPI as u32);
+ }
+
let (mut handle, thread) = builder.build();
if !handle.is_window_ready() {
return Err("Raylib window not ready!".into());