Giter Site home page Giter Site logo

bevy_titan's Introduction

bevy_titan

crates.io Bevy tracking docs.rs MIT/Apache 2.0

bevy bevy_titan
main main
0.14 0.7.0
0.13 0.6.0
0.12 0.4.0, 0.5.0
0.11 0.3.0
0.10 0.2.0
0.9 0.1.1

What is bevy_titan?

bevy_titan is a simple bevy plugin to load textures atlases from spritesheet manifest files written in ron. It also supports creating a texture atlas from multiple sprites and even multiple sprite sheets. Supports hot reloading.

Quickstart

# In your Cargo.toml
bevy_titan = "0.7"

homogeneous-sprite-sheet.titan

//! A basic example of a titan file for a homogeneous sprite sheet.
(
    textures: [
        (
            path: "path-to-homogeneous-sprite-sheet",
            sprite_sheet: Homogeneous (
                tile_size: (
                    32,
                    32,
                ),
                columns: 4,
                rows: 1,
            ),
        ),
    ]
)

heterogeneous-sprite-sheet.titan

//! A basic example of a titan file for a heterogeneous sprite sheet.
(
    textures: [
        (
            path: "path-to-heterogeneous-sprite-sheet",
            sprite_sheet: Heterogeneous (
                [
                    (
                        (0, 0),
                        (16, 16),
                    ),
                    (
                        (16, 0),
                        (32, 128),
                    ),
                    (
                        (48, 0),
                        (64, 16),
                    ),
                ]
            ),
        ),
    ]
)

main.rs

//! A basic example of how to create a TextureAtlas asset from a titan file.
use bevy::prelude::*;
use bevy_titan::SpriteSheetLoaderPlugin;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugins(SpriteSheetLoaderPlugin)
        .add_systems(Startup, (setup, load_texture_atlas).chain())
        .run();
}

fn setup() {
    /* Setup camera and other stuff */
}

fn load_texture_atlas(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands.spawn((
        SpriteBundle {
            texture: asset_server.load("example.titan#texture"),
            transform: Transform::from_scale(Vec3::splat(6.0)),
            ..default()
        },
        TextureAtlas {
            layout: asset_server.load("example.titan#layout"),
            ..Default::default()
        }
    ));
}

Documentation

Full API Documentation

File format specifiction

Examples

Future Work

  • Make use of bevy's AssetProcessor.

License

bevy_titan is free, open source and permissively licensed! Except where noted (below and/or in individual files), all code in this repository is dual-licensed under either:

at your option. This means you can select the license you prefer!

Some of the code was adapted from other sources. The assets included in this repository fall under different open licenses. See CREDITS.md for the details of the origin of the adapted code and licenses of those files.

Your contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

bevy_titan's People

Contributors

kirmesbude avatar johanhelsing avatar

Stargazers

Accumulator avatar Ame アメ avatar Rancic avatar Abe avatar wood avatar orzogc avatar Sandalots avatar Chung avatar  avatar

Watchers

 avatar

Forkers

johanhelsing

bevy_titan's Issues

Sprite animation timings?

Hey, I've been looking for something like this to improve my Krita -> bevy workflow.

I'm using Krita to do sprite animations, and currently I'm animating at 60 FPS, because that's what my game logic and networking solution runs at. However, when holding a pose for several frames (which happens a lot due to the high frame rate), I don't want to have duplicate textures.

So I'm looking for a system that will also allow me to also embed some timing information in the manifest.

If this is out of scope for the project, I'm perfectly happy forking (thanks for sharing!), but I thought I'd ask in case this is something you'd want to support as well.

Fix README

License badge still points to bevy license.
There is some wrong text in the main.rs example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.