Skip to content

Commit

Permalink
Upgrade to bevy 0.11 (#53)
Browse files Browse the repository at this point in the history
* Upgrade to bevy 0.11

* Run tests with the right rust version

* Disable udeps as bevy relies on an incompatible version of proc-macros2
  • Loading branch information
abnormalbrain authored Jul 14, 2023
1 parent 22dec26 commit 8047ab6
Show file tree
Hide file tree
Showing 13 changed files with 101 additions and 93 deletions.
51 changes: 25 additions & 26 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ on:

env:
CARGO_TERM_COLOR: always
RUST_VERSION: 1.67.1
RUST_VERSION: 1.70.0

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
override: true
profile: minimal
- run: cargo check --all-targets
- run: cargo test --no-default-features
- run: cargo test
- run: cargo test --all-features
- run: cargo test --all-features -- --ignored
- uses: actions/checkout@v3
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
override: true
profile: minimal

- run: cargo check --all-targets
- run: cargo test --no-default-features
- run: cargo test
- run: cargo test --all-features
- run: cargo test --all-features -- --ignored

code-style:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,15 +57,14 @@ jobs:
override: true
profile: minimal
- run: cargo doc --all-features --no-deps

unused-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
profile: minimal
- run: cargo install cargo-udeps --locked
- run: cargo udeps
# unused-dependencies:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: nightly
# override: true
# profile: minimal
# - run: cargo install cargo-udeps --locked
# - run: cargo udeps
26 changes: 13 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "bevy_particle_systems"
version = "0.9.0"
version = "0.10.0"
edition = "2021"
rust-version = "1.65"
rust-version = "1.70"
authors = ["Abnormal Brain Studios"]
license = "MIT"
description = "A particle system plugin for Bevy"
Expand All @@ -14,20 +14,20 @@ categories = ["game-development"]
debug = true

[dependencies]
bevy_app = "0.10"
bevy_asset = "0.10"
bevy_ecs = "0.10"
bevy_hierarchy = "0.10"
bevy_math = "0.10"
bevy_render = "0.10"
bevy_sprite = "0.10"
bevy_time = "0.10"
bevy_transform = "0.10"
bevy_reflect = "0.10"
bevy_app = "0.11"
bevy_asset = "0.11"
bevy_ecs = "0.11"
bevy_hierarchy = "0.11"
bevy_math = "0.11"
bevy_render = "0.11"
bevy_sprite = "0.11"
bevy_time = "0.11"
bevy_transform = "0.11"
bevy_reflect = "0.11"
rand = "0.8"

[dev-dependencies]
bevy = { version = "0.10", default-features=false, features = [
bevy = { version = "0.11", default-features=false, features = [
"bevy_asset",
"bevy_sprite",
"bevy_core_pipeline",
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ use bevy_particle_systems::ParticleSystemPlugin;

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(ParticleSystemPlugin::default()) // <-- Add the plugin
.add_plugins((DefaultPlugins, ParticleSystemPlugin::default())) // <-- Add the plugin
// ...
.add_startup_system(spawn_particle_system)
.add_systems(Startup, spawn_particle_system)
.run();
}

Expand Down Expand Up @@ -75,6 +74,7 @@ fn spawn_particle_system(mut commands: Commands, asset_server: Res<AssetServer>)

|`bevy_particle_systems`|`bevy`|
|:--|:--|
|0.10|0.11|
|0.9|0.10|
|0.6 - 0.8|0.9|
|0.5|0.8|
Expand Down
12 changes: 7 additions & 5 deletions examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ use bevy_particle_systems::{
fn main() {
App::new()
.insert_resource(ClearColor(Color::BLACK))
.add_plugin(EntityCountDiagnosticsPlugin)
.add_plugin(FrameTimeDiagnosticsPlugin::default())
.add_plugin(LogDiagnosticsPlugin::default())
.add_plugins((
EntityCountDiagnosticsPlugin,
FrameTimeDiagnosticsPlugin::default(),
LogDiagnosticsPlugin::default(),
))
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
present_mode: PresentMode::AutoNoVsync,
..default()
}),
..default()
}))
.add_plugin(ParticleSystemPlugin::default()) // <-- Add the plugin
.add_startup_system(startup_system)
.add_plugins(ParticleSystemPlugin::default()) // <-- Add the plugin
.add_systems(Startup, startup_system)
.run();
}

Expand Down
12 changes: 7 additions & 5 deletions examples/directional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ use bevy_particle_systems::{
fn main() {
App::new()
.insert_resource(ClearColor(Color::BLACK))
.add_plugin(EntityCountDiagnosticsPlugin)
.add_plugin(FrameTimeDiagnosticsPlugin::default())
.add_plugin(LogDiagnosticsPlugin::default())
.add_plugins((
EntityCountDiagnosticsPlugin,
FrameTimeDiagnosticsPlugin::default(),
LogDiagnosticsPlugin::default(),
))
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
present_mode: PresentMode::AutoNoVsync,
..default()
}),
..default()
}))
.add_plugin(ParticleSystemPlugin::default()) // <-- Add the plugin
.add_startup_system(startup_system)
.add_plugins(ParticleSystemPlugin::default()) // <-- Add the plugin
.add_systems(Startup, startup_system)
.run();
}

Expand Down
8 changes: 4 additions & 4 deletions examples/local_space.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use bevy::{
prelude::{App, Camera2dBundle, Color, Commands, Component, Query, Res, Transform, With},
DefaultPlugins,
};
use bevy_app::{Startup, Update};
use bevy_asset::AssetServer;
use bevy_math::Quat;
use bevy_time::Time;
Expand All @@ -25,10 +26,9 @@ pub struct Targets {

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(ParticleSystemPlugin::default()) // <-- Add the plugin
.add_startup_system(startup_system)
.add_system(circler)
.add_plugins((DefaultPlugins, ParticleSystemPlugin::default())) // <-- Add the plugin
.add_systems(Startup, startup_system)
.add_systems(Update, circler)
.run();
}

Expand Down
12 changes: 7 additions & 5 deletions examples/shape_emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@ use bevy_particle_systems::{
fn main() {
App::new()
.insert_resource(ClearColor(Color::BLACK))
.add_plugin(EntityCountDiagnosticsPlugin)
.add_plugin(FrameTimeDiagnosticsPlugin::default())
.add_plugin(LogDiagnosticsPlugin::default())
.add_plugins((
EntityCountDiagnosticsPlugin,
FrameTimeDiagnosticsPlugin::default(),
LogDiagnosticsPlugin::default(),
))
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
present_mode: PresentMode::AutoNoVsync,
..default()
}),
..default()
}))
.add_plugin(ParticleSystemPlugin::default()) // <-- Add the plugin
.add_startup_system(startup_system)
.add_plugins(ParticleSystemPlugin::default()) // <-- Add the plugin
.add_systems(Startup, startup_system)
.run();
}

Expand Down
6 changes: 3 additions & 3 deletions examples/texture_atlas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use bevy::{
prelude::{Camera2dBundle, ClearColor, Color, Commands, ImagePlugin, Res, ResMut, Transform},
DefaultPlugins,
};
use bevy_app::{App, PluginGroup};
use bevy_app::{App, PluginGroup, Startup};
use bevy_asset::{AssetServer, Assets};
use bevy_math::Vec2;
use bevy_particle_systems::{
Expand All @@ -21,8 +21,8 @@ fn main() {
App::new()
.insert_resource(ClearColor(Color::BLACK))
.add_plugins(DefaultPlugins.set(ImagePlugin::default_nearest()))
.add_plugin(ParticleSystemPlugin)
.add_startup_systems((startup_system, setup_ground))
.add_plugins(ParticleSystemPlugin)
.add_systems(Startup, (startup_system, setup_ground))
.run();
}

Expand Down
8 changes: 4 additions & 4 deletions examples/time_scaling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use bevy::{
prelude::{App, Camera2dBundle, Color, Commands, KeyCode, Res, ResMut, Transform},
DefaultPlugins,
};
use bevy_app::{Startup, Update};
use bevy_asset::AssetServer;
use bevy_particle_systems::{
CircleSegment, ColorOverTime, Curve, CurvePoint, JitteredValue, ParticleSpace, ParticleSystem,
Expand All @@ -16,10 +17,9 @@ use bevy_particle_systems::{
use bevy_time::Time;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(ParticleSystemPlugin::default()) // <-- Add the plugin
.add_startup_system(startup_system)
.add_system(time_scale_changer)
.add_plugins((DefaultPlugins, ParticleSystemPlugin::default())) // <-- Add the plugin
.add_systems(Startup, startup_system)
.add_systems(Update, time_scale_changer)
.run();
}

Expand Down
6 changes: 3 additions & 3 deletions examples/velocity_modifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use bevy::{
prelude::{App, Camera2dBundle, Color, Commands, Component, Res, Transform},
DefaultPlugins,
};
use bevy_app::Startup;
use bevy_asset::AssetServer;

use bevy_particle_systems::{
Expand All @@ -27,9 +28,8 @@ pub struct Targets {

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(ParticleSystemPlugin::default()) // <-- Add the plugin
.add_startup_system(startup_system)
.add_plugins((DefaultPlugins, ParticleSystemPlugin::default())) // <-- Add the plugin
.add_systems(Startup, startup_system)
.run();
}

Expand Down
8 changes: 4 additions & 4 deletions src/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{
/// Defines a burst of a specified number of particles at the given time in a running particle system.
///
/// Bursts do not count as part of the per-second spawn rate.
#[derive(Debug, Clone, Copy, Reflect, FromReflect)]
#[derive(Debug, Clone, Copy, Reflect)]
pub struct ParticleBurst {
/// The time during the life cycle of a system that the burst should occur.
///
Expand All @@ -39,7 +39,7 @@ impl ParticleBurst {
}

/// Defines what space a particle should operate in.
#[derive(Debug, Clone, Copy, Reflect, FromReflect)]
#[derive(Debug, Clone, Copy, Reflect)]
pub enum ParticleSpace {
/// Indicates particles should move relative to a parent.
Local,
Expand All @@ -48,7 +48,7 @@ pub enum ParticleSpace {
}

/// Defines what texture to use for a particle
#[derive(Debug, Clone, Reflect, FromReflect)]
#[derive(Debug, Clone, Reflect)]
pub enum ParticleTexture {
/// Indicates particles should use a given image texture
Sprite(Handle<Image>),
Expand All @@ -62,7 +62,7 @@ pub enum ParticleTexture {
}

/// Defines how will be animated the texture atlas index
#[derive(Component, Debug, Clone, Reflect, FromReflect)]
#[derive(Component, Debug, Clone, Reflect)]
pub struct AnimatedIndex {
/// At what indices are the different frames on a sprite sheet
pub indices: Vec<usize>,
Expand Down
9 changes: 6 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ pub mod components;
mod systems;
pub mod values;

use bevy_app::prelude::{App, Plugin};
use bevy_app::{
prelude::{App, Plugin},
Update,
};
use bevy_ecs::prelude::IntoSystemConfigs;
pub use components::*;
pub use systems::ParticleSystemSet;
Expand All @@ -83,8 +86,7 @@ pub use values::*;
///
/// fn main() {
/// App::new()
/// .add_plugins(DefaultPlugins)
/// .add_plugin(ParticleSystemPlugin::default()) // <-- Add the plugin
/// .add_plugins((DefaultPlugins, ParticleSystemPlugin::default())) // <-- Add the plugin
/// // ...
/// .run();
/// }
Expand All @@ -95,6 +97,7 @@ pub struct ParticleSystemPlugin;
impl Plugin for ParticleSystemPlugin {
fn build(&self, app: &mut App) {
app.add_systems(
Update,
(
particle_spawner,
particle_lifetime,
Expand Down
Loading

0 comments on commit 8047ab6

Please sign in to comment.