Skip to content

Crate for importing .aseprite files directly into Bevy applications

License

Notifications You must be signed in to change notification settings

B-Reif/bevy_ase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Utilities for loading Aseprite files into a Bevy application.

Provides an AssetLoader struct which directly reads .aseprite files without an intermediate import step. The loader adds Resources generated by the files' data. Systems can invoke the loader's methods to start loading files, or query the loading state.

Resources

This library creates several types of resources:

  • Texture data, which contains the file's images.
  • TextureAtlas data, which contains mapping information for each sprite in a spritesheet.
  • Animation data.
  • Slice data.
  • Tileset data (from files created in Aseprite v1.3 beta).

Configuration

This library exposes AseLoaderDefaultPlugin with default settings. This plugin initializes all of the above resources as Asset types, adds Loader and AseAssetLoader resources, and adds an importer system function to process loaded ase data.

For a custom configuration, import the constituent parts and add them to AppBuilder directly. The Texture resource is required to be initialized. Other asset types are optional.

Examples

use bevy::prelude::*;
use bevy_ase::asset::AseAsset;
use bevy_ase::loader::{AseLoaderDefaultPlugin, Loader};
use std::path::Path;

// Initialize and run a bevy app with the default bevy_ase configuration.
fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugin(AseLoaderDefaultPlugin)
        .add_system(load_sprites.system());
}

// Get an aseprite asset and send it to the loader.
pub fn load_sprites(asset_server: Res<AssetServer>, mut loader: ResMut<Loader>) {
    let h: Handle<AseAsset> = asset_server.load(Path::new("sprites/hello.aseprite"));
    loader.add(h.clone());
}

See the documentation for lib.rs for more information.

Forked from https://github.com/alpine-alpaca/bevy_proto_aseprite.

Example

cargo run --example animated --features="benimator"

TODOs

  • Improve error handling.

  • Atlas creation fails if there are too many / too big sprites.

  • Hot reloading. This requires dynamic atlas reconstruction.

About

Crate for importing .aseprite files directly into Bevy applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages