#xml #assets #xml-parser #bevy #gamedev

bevy_xml

Bevy的Sparrow SpriteSheet XML解析器!

2个不稳定版本

0.2.0 2023年5月6日
0.1.0 2023年5月4日

#1960游戏开发

每月 23次下载

自定义许可证

22KB
476

Bevy tracking crates.io docs.rs

Bevy Sparrow XML解析器

这个工具箱是Bevy的插件,用于解析SpriteSheet XML文件!在从Adobe Animate使用资源时非常有用。

使用此工具箱

以下是使用此工具箱的示例代码

use bevy::prelude::*;
use bevy_xml::*;

fn main()
{
    app
        .add_system(bevy_xml::tick_animations)
        .run();
}
fn your_startup_system(mut texture_atlases: ResMut<Assets<TextureAtlas>>, asset_loader: Res<AssetServer>)
{
    let bfs = texture_atlases.add(TextureAtlas::new_empty(asset_loader.load("images/bf.png"), Vec2::new(8192.0, 4096.0))); // handle
    let Some(bf) = texture_atlases.get_mut(&bfs) else { return };
    let xml = SpriteXMLBundle::new("assets/images/bf.xml".to_string(), &bfs, bf);

    match xml {
        Some(c) =>
        {
            c.add_anim_from_prefix("Epic Animation", false, 24); // anim name, is the animation looped?, fps
            c.apply_offsets(); // applies inital offset
            c.set_anim("Epic Animation", bf, true); // sets the current animation
                    // anim name^  sprite^   ^ set the current frame to zero?
            commands.spawn(c);
        },
        None =>
        {
            error!("Failed to Parse XML!");
        }

    }
}


此工具箱提供的功能

此工具箱现在具有动画系统,支持3D精灵,以及更多功能!

免责声明!

我以前从未发布过工具箱,所以如果存在问题,请给我反馈!

依赖项

~48–87MB
~1.5M SLoC