summaryrefslogtreecommitdiff
path: root/graphics/src/assets.rs
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/src/assets.rs')
-rw-r--r--graphics/src/assets.rs25
1 files changed, 2 insertions, 23 deletions
diff --git a/graphics/src/assets.rs b/graphics/src/assets.rs
index 3f2354a..edac69b 100644
--- a/graphics/src/assets.rs
+++ b/graphics/src/assets.rs
@@ -1,8 +1,6 @@
//! The `assets` crate stores all audio and image assets that need to be
//! loaded during runtime
-use std::error::Error;
-
use raylib::{RaylibHandle, RaylibThread, audio::RaylibAudio};
#[expect(dead_code)]
@@ -14,7 +12,7 @@ type Sound = raylib::audio::Sound<'static>;
#[derive(Debug)]
pub struct AudioData {}
impl AudioData {
- pub(crate) fn load() -> Result<Self, Box<dyn Error>> {
+ pub(crate) fn load() -> crate::Result<Self> {
// Phantom handle to the raylib audio subsystem
// Raylib doesnt use a handle, but the rust bindings
// have one to ensure memory safety.
@@ -41,7 +39,7 @@ impl ImageData {
pub(crate) fn load(
_handle: &mut RaylibHandle,
_thread: &RaylibThread,
- ) -> Result<Self, Box<dyn Error>> {
+ ) -> crate::Result<Self> {
// TODO: load image data
//let example = handle.load_texture(&thread, "example.png");
@@ -49,22 +47,3 @@ impl ImageData {
Ok(Self {})
}
}
-
-#[derive(Debug)]
-pub(crate) struct Assets {
- /// Audio needs to be accessible outside of the renderer
- pub(crate) audio: AudioData,
- /// Images are only needed by the renderer
- pub(crate) image: ImageData,
-}
-impl Assets {
- pub(crate) fn load(
- handle: &mut RaylibHandle,
- thread: &RaylibThread,
- ) -> Result<Self, Box<dyn Error>> {
- let audio = AudioData::load()?;
- let image = ImageData::load(handle, thread)?;
-
- Ok(Self { audio, image })
- }
-}