Skip to content
Snippets Groups Projects
Verified Commit a4b33834 authored by Louis's avatar Louis :fire:
Browse files

Support Bevy version 0.14

parent 1bedc2fd
No related branches found
No related tags found
No related merge requests found
[package]
name = "micro_banimate"
version = "0.8.0"
version = "0.9.0"
edition = "2021"
license = "Apache-2.0"
description = "Easily manage complex Bevy 2D sprite animations"
authors = [
"Louis Capitanchik <louis@microhacks.co.uk>"
"Louis Capitanchik <louis@microhacks.co.uk>"
]
repository = "https://lab.lcr.gr/microhacks/micro-banimate"
......@@ -25,8 +25,8 @@ anyhow = "^1.0"
serde = { version = "^1.0", optional = true }
serde_json = { version = "^1.0", optional = true }
toml = { version = "0.8", optional = true }
bevy = { version = "^0.13.0", default-features = false, features = ["bevy_asset", "bevy_sprite"] }
bevy = { version = "^0.14", default-features = false, features = ["bevy_asset", "bevy_sprite"] }
[dev_dependencies]
bevy = "0.13"
[dev-dependencies]
bevy = "0.14"
log = "0.4"
......@@ -60,22 +60,22 @@ like this:
```json
{
"idle": {
"frames": [
1,
2,
3
],
"frame_time": 250
"frames": [
1,
2,
3
],
"frame_time": 250
},
"shoot_right": {
"frames": [
34,
34,
34,
35,
36
],
"frame_time": 100
"frames": [
34,
34,
34,
35,
36
],
"frame_time": 100
}
}
```
......@@ -99,6 +99,7 @@ frame_time = 100
| banimate version | bevy version | tilemap version |
|---------------------|--------------|------------------------------------------|
| 0.9.0 | 0.14 | n/a |
| 0.8.0 | 0.13 | n/a |
| 0.7.0 | 0.12 | n/a |
| 0.6.0-rc.1 | 0.11 | 55c15bfa43c7a9e2adef6b70007e92d699377454 |
......
......@@ -28,7 +28,7 @@ fn load_assets(
) {
let sprites = assets.load("character.png");
let atlas = atlas.add(TextureAtlasLayout::from_grid(
Vec2::new(48., 48.),
UVec2::new(48, 48),
10,
6,
None,
......@@ -48,12 +48,12 @@ fn spawn_assets(mut commands: Commands, assets: Res<ExampleAssets>) {
const HEIGHT: f32 = 320.0;
commands.spawn((
SpriteSheetBundle {
TextureAtlas {
layout: assets.atlas.clone_weak(),
index: 0,
},
SpriteBundle {
texture: assets.sprites.clone_weak(),
atlas: TextureAtlas {
layout: assets.atlas.clone_weak(),
index: 0,
},
..Default::default()
},
DirectionalAnimationBundle::with_direction(
......
......@@ -27,7 +27,7 @@ impl Error for LoaderError {}
#[cfg(feature = "json_loader")]
mod json_loader {
use bevy::asset::io::Reader;
use bevy::asset::{AssetLoader, AsyncReadExt, BoxedFuture, LoadContext};
use bevy::asset::{AssetLoader, AsyncReadExt, LoadContext};
use crate::definitions::AnimationSet;
use crate::loader::LoaderError;
......@@ -38,21 +38,19 @@ mod json_loader {
type Settings = ();
type Error = LoaderError;
fn load<'a>(
async fn load<'a>(
&'a self,
reader: &'a mut Reader,
reader: &'a mut Reader<'_>,
_settings: &'a Self::Settings,
_load_context: &'a mut LoadContext,
) -> BoxedFuture<'a, Result<Self::Asset, Self::Error>> {
Box::pin(async move {
let mut bytes = Vec::new();
reader
.read_to_end(&mut bytes)
.await
.expect("Failed to read all bytes");
serde_json::from_slice(bytes.as_slice()).map_err(LoaderError::Json)
})
_load_context: &'a mut LoadContext<'_>,
) -> Result<Self::Asset, Self::Error> {
let mut bytes = Vec::new();
reader
.read_to_end(&mut bytes)
.await
.expect("Failed to read all bytes");
serde_json::from_slice(bytes.as_slice()).map_err(LoaderError::Json)
}
fn extensions(&self) -> &[&str] {
......@@ -65,7 +63,7 @@ mod json_loader {
#[cfg(feature = "toml_loader")]
mod toml_loader {
use bevy::asset::io::Reader;
use bevy::asset::{AssetLoader, AsyncReadExt, BoxedFuture, LoadContext};
use bevy::asset::{AssetLoader, AsyncReadExt, LoadContext};
use crate::definitions::AnimationSet;
use crate::loader::LoaderError;
......@@ -76,21 +74,19 @@ mod toml_loader {
type Settings = ();
type Error = LoaderError;
fn load<'a>(
async fn load<'a>(
&'a self,
reader: &'a mut Reader,
reader: &'a mut Reader<'_>,
_settings: &'a Self::Settings,
_load_context: &'a mut LoadContext,
) -> BoxedFuture<'a, Result<Self::Asset, Self::Error>> {
Box::pin(async move {
let mut bytes = String::new();
reader
.read_to_string(&mut bytes)
.await
.expect("Failed to read all bytes");
toml::from_str(bytes.as_str()).map_err(LoaderError::Toml)
})
_load_context: &'a mut LoadContext<'_>,
) -> Result<Self::Asset, Self::Error> {
let mut bytes = String::new();
reader
.read_to_string(&mut bytes)
.await
.expect("Failed to read all bytes");
toml::from_str(bytes.as_str()).map_err(LoaderError::Toml)
}
fn extensions(&self) -> &[&str] {
......
......@@ -10,7 +10,7 @@ pub enum AnimationSystems {
SyncAnimations,
}
#[derive(Copy, Clone, Debug, Component, PartialEq, Eq, Ord, PartialOrd, Event)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Ord, PartialOrd, Event)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct AnimationCompleted {
pub entity: Entity,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment