logo
pub trait AssetPack: Disposable {
    fn texture(
        &self,
        name: String,
        required: bool
    ) -> Option<Rc<dyn Texture + 'static>>; fn sound(
        &self,
        name: String,
        required: bool
    ) -> Option<Rc<dyn Sound + 'static>>; fn file(
        &self,
        name: String,
        required: bool
    ) -> Option<Rc<dyn File + 'static>>; }
Expand description

Represents a collection of fully loaded assets.

Required Methods

The manifest that was used to load this asset pack. Gets a texture by name from the asset pack. The name must NOT contain a filename extension. Textures are cached, so it’s safe to get the same texture multiple times. @param required If true and the asset was not found, an error is thrown.

Gets a sound by name from the asset pack. The name must NOT contain a filename extension. Sounds are cached, so it’s safe to get the same sound multiple times. @param required If true and the asset was not found, an error is thrown.

Gets a file by name from the asset pack, returning its raw content. Files are cached, so it’s safe to get the same file multiple times. @param required If true and the asset was not found, an error is thrown.

Implementors