灵符lingfu

ling-game

↓ 4890 downloads

Entity-Component-System + physics for games

Keywords game, ecs, physics, engine
lingfu install ling-game
LicenseApache-2.0 OR MIT
AuthorsLing Lin, Sanny Lin
READMECode / FilesVersionsDependency GraphDependentsSecurityBuildsSettings

Code / Files (13)

src/audio.rs
//! Game audio stubs — delegates to ling-audio at runtime.

/// A handle to a loaded sound asset.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct SoundHandle(pub u32);

/// Simple in-game audio mixer state.
#[derive(Debug, Default)]
pub struct AudioMixer {
    next_handle: u32,
}

impl AudioMixer {
    pub fn new() -> Self {
        Self::default()
    }

    /// Register a sound; returns a reusable handle.
    pub fn register(&mut self) -> SoundHandle {
        let h = SoundHandle(self.next_handle);
        self.next_handle += 1;
        h
    }
}

← Back to index