pub struct SkeletonBinary { /* private fields */ }
Expand description

A loader for Spine binary files.

Spine API Reference

Implementations

Create a new Binary loader using the default atlas attachment loader.

use std::sync::Arc;
use rusty_spine::{AnimationState, AnimationStateData, Atlas, SpineError, Skeleton, SkeletonBinary};

fn load_skeleton() -> Result<(Skeleton, AnimationState), SpineError> {
    let atlas = Arc::new(Atlas::new_from_file("spineboy.atlas")?);
    let skeleton_binary = SkeletonBinary::new(atlas);
    let skeleton_data = Arc::new(skeleton_binary.read_skeleton_data_file("spineboy.skel")?);
    let animation_state_data = AnimationStateData::new(skeleton_data.clone());
    // ... prepare animation state (see AnimationStateData docs) ...
    let skeleton = Skeleton::new(skeleton_data);
    let animation_state = AnimationState::new(Arc::new(animation_state_data));
    Ok((skeleton, animation_state))
}

Read the Spine skeleton binary data in-memory. See SkeletonBinary::new for a full example.

Errors

Returns SpineError::ParsingFailed if parsing of the binary data failed.

Read the Spine skeleton binary data from a file. See SkeletonBinary::new for a full example.

Errors

Returns SpineError::ParsingFailed if parsing of the binary data failed. Returns SpineError::NulError if path contains an internal 0 byte.

Trait Implementations

Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.