diff options
Diffstat (limited to 'graphics/src/assets.rs')
| -rw-r--r-- | graphics/src/assets.rs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/graphics/src/assets.rs b/graphics/src/assets.rs index e607fdf..bb989a3 100644 --- a/graphics/src/assets.rs +++ b/graphics/src/assets.rs @@ -1,6 +1,7 @@ //! The `assets` crate stores all audio and image assets that need to be //! loaded during runtime +use dungeon::Item; use raylib::{RaylibHandle, RaylibThread, audio::RaylibAudio, texture::Texture2D}; #[expect(dead_code)] @@ -50,6 +51,8 @@ pub(crate) enum AtlasTexture { WallEdgeSouth, WallEdgeWest, Player, + InvTopLayer, + InvBottomLayer, Error, } impl AtlasTexture { @@ -66,6 +69,8 @@ impl AtlasTexture { Self::WallEdgeSouth => (2, 1), Self::WallEdgeWest => (3, 1), Self::Player => (0, 2), + Self::InvTopLayer => (1, 2), + Self::InvBottomLayer => (2, 2), Self::Error => (3, 3), } } @@ -87,6 +92,10 @@ impl AtlasTexture { #[derive(Debug)] pub(crate) struct ImageData { pub(crate) atlas: Texture2D, + pub(crate) heart_full: Texture2D, + pub(crate) heart_half: Texture2D, + pub(crate) heart_empty: Texture2D, + pub(crate) error: Texture2D, } impl ImageData { pub(crate) fn load( @@ -94,7 +103,22 @@ impl ImageData { thread: &RaylibThread, ) -> crate::Result<Self> { let atlas = handle.load_texture(thread, "assets/atlas.bmp")?; + let heart_full = handle.load_texture(thread, "assets/heart_full.bmp")?; + let heart_half = handle.load_texture(thread, "assets/heart_half.bmp")?; + let heart_empty = handle.load_texture(thread, "assets/heart_empty.bmp")?; + let error = handle.load_texture(thread, "assets/error.bmp")?; - Ok(Self { atlas }) + Ok(Self { + atlas, + heart_full, + heart_half, + heart_empty, + error, + }) + } + + pub(crate) fn get_item_texture(&self, _item: &Item) -> &Texture2D { + // TODO: make item textures + &self.error } } |