diff options
| author | Freya Murphy <freya@freyacat.org> | 2025-11-11 19:51:36 -0500 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2025-11-11 19:51:36 -0500 |
| commit | 1dcf5bbc1dd5d53285cf5a6751e034a24644f812 (patch) | |
| tree | 11b640ce122e45c14e374b51e570296cdaa892dd | |
| parent | didnt work (diff) | |
| download | DungeonCrawl-1dcf5bbc1dd5d53285cf5a6751e034a24644f812.tar.gz DungeonCrawl-1dcf5bbc1dd5d53285cf5a6751e034a24644f812.tar.bz2 DungeonCrawl-1dcf5bbc1dd5d53285cf5a6751e034a24644f812.zip | |
graphics: load_texture! can be simplified
| -rw-r--r-- | graphics/src/render.rs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/graphics/src/render.rs b/graphics/src/render.rs index 9ff156a..501f140 100644 --- a/graphics/src/render.rs +++ b/graphics/src/render.rs @@ -49,22 +49,18 @@ macro_rules! draw_text { }}; } -#[cfg(not(feature = "static"))] macro_rules! load_texture { ($handle:expr, $thread:expr, $filepath:expr) => { - $handle.load_texture($thread, $filepath)? + if cfg!(feature = "static") { + let bytes = include_bytes!(concat!("../../", $filepath)); + let image = ::raylib::texture::Image::load_image_from_mem(".bmp", bytes)?; + $handle.load_texture_from_image($thread, &image)? + } else { + $handle.load_texture($thread, $filepath)? + } }; } -#[cfg(feature = "static")] -macro_rules! load_texture { - ($handle:expr, $thread:expr, $filepath:expr) => {{ - let bytes = include_bytes!(concat!("../../", $filepath)); - let image = ::raylib::texture::Image::load_image_from_mem(".bmp", bytes)?; - $handle.load_texture_from_image($thread, &image)? - }}; -} - /// The baseline size of all ingame sprites and tile textures const TEXTURE_SIZE: u16 = 16; |