Skip to main content

Resources

Struct Resources 

Source
pub struct Resources {
    pub archive: Rc<Archive>,
    pub sheets: Vec<LoadedSheet>,
    pub fonts: Vec<LoadedFont>,
    /* private fields */
}
Expand description

The resource cache.

Fields§

§archive: Rc<Archive>

The game’s packages.

§sheets: Vec<LoadedSheet>

The loaded sprite sheets.

§fonts: Vec<LoadedFont>

The loaded fonts.

Implementations§

Source§

impl Resources

Source

pub fn new(archive: Rc<Archive>) -> Self

An empty cache over archive.

Source

pub fn element(&mut self, reference: &str) -> Option<Rc<Element>>

An element description by reference.

Source

pub fn sheet(&mut self, reference: &str) -> Option<SheetId>

A sprite sheet by reference.

Source

pub fn image_sheet( &mut self, key: &str, width: u32, height: u32, rgba: Vec<u8>, ) -> SpriteRef

A sheet with one sprite, around an image made at run time, for example a save’s preview picture. key names it: the same key gives the same sheet, with the image it was first made with.

Original: FUN_1400bc1b0 (a UI::SpriteSheet with AddSpriteInfo(0, 0, w, h)).

Source

pub fn sprite( &mut self, sheet_ref: Option<&str>, name: &str, ) -> Option<SpriteRef>

A sprite by its sheet’s reference and its name.

Source

pub fn font(&mut self, reference: &str) -> Option<FontId>

A font by reference.

Source

pub fn string_at(&mut self, table: &str, index: i32) -> String

UI::String(table, index): entry index of a string table in serialized order (StringTable::GetIndexFromName searches that order). Empty when out of range.

Source

pub fn string(&mut self, table: Option<&str>, key: &str) -> String

Resolve a string-table key; falls back to the key itself.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.