Skip to content

Commit

Permalink
update to bevy v0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaBatty committed Jul 6, 2024
1 parent 9f5c661 commit cf7ba52
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 23 deletions.
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_midi"
version = "0.8.0"
version = "0.9.0"
authors = ["Black Phlox <[email protected]>"]
edition = "2021"
license = "MIT OR Apache-2.0"
Expand All @@ -25,21 +25,21 @@ midir = "0.10"
crossbeam-channel = "0.5.8"

[dev-dependencies]
bevy_egui = { version = "0.27", features = ["immutable_ctx"]}
bevy_egui = { version = "0.28", features = ["immutable_ctx"]}
strum = { version = "0.26", features = ["derive"] }
bevy_mod_picking = "0.18"
bevy_mod_picking = "0.20"

[dependencies.bevy]
version = "0.13"
version = "0.14"
default-features = false
features = ["multi-threaded"]
features = ["multi_threaded"]

[dev-dependencies.bevy]
version = "0.13"
version = "0.14"
features = ["bevy_core_pipeline","bevy_asset", "bevy_scene", "bevy_render", "bevy_winit", "bevy_gltf", "bevy_ui", "bevy_text", "zstd", "tonemapping_luts", "ktx2", "hdr"]
default-features = false

[target.'cfg(target_os = "linux")'.dev-dependencies.bevy]
version = "0.13"
version = "0.14"
features = ["x11", "wayland"]
default-features = false
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ See examples
|0.10|0.6.X|
|0.12|0.7.X|
|0.13|0.8.X|
|0.14|0.9.X|

# Licensing
The project is under dual license MIT and Apache 2.0, so joink to your hearts content, just remember the license agreements.
Expand Down
9 changes: 5 additions & 4 deletions examples/input.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use bevy::{
color::palettes::basic::{GREEN, RED},
log::{Level, LogPlugin},
prelude::*,
};
Expand Down Expand Up @@ -27,7 +28,7 @@ fn main() {
.add_plugins(DefaultPlugins.set(LogPlugin {
level: Level::WARN,
filter: "bevy_midi=debug".to_string(),
update_subscriber: None,
..default()
}))
.add_plugins(MidiInputPlugin)
.add_systems(Startup, setup)
Expand Down Expand Up @@ -90,10 +91,10 @@ fn show_connection(
let text_section = &mut instructions.single_mut().sections[2];
if connection.is_connected() {
text_section.value = "Connected\n".to_string();
text_section.style.color = Color::GREEN;
text_section.style.color = GREEN.into();
} else {
text_section.value = "Disconnected\n".to_string();
text_section.style.color = Color::RED;
text_section.style.color = RED.into();
}
}
}
Expand Down Expand Up @@ -146,7 +147,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 30.0,
color: Color::RED,
color: RED.into(),
},
),
TextSection::new(
Expand Down
11 changes: 7 additions & 4 deletions examples/output.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use bevy::prelude::*;
use bevy::{
color::palettes::basic::{GREEN, RED},
prelude::*,
};
use bevy_midi::prelude::*;

const KEY_PORT_MAP: [(KeyCode, usize); 10] = [
Expand Down Expand Up @@ -102,10 +105,10 @@ fn show_connection(
let text_section = &mut instructions.single_mut().sections[2];
if connection.is_connected() {
text_section.value = "Connected".to_string();
text_section.style.color = Color::GREEN;
text_section.style.color = GREEN.into();
} else {
text_section.value = "Disconnected".to_string();
text_section.style.color = Color::RED;
text_section.style.color = RED.into();
}
}
}
Expand Down Expand Up @@ -139,7 +142,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 30.0,
color: Color::RED,
color: RED.into(),
},
),
],
Expand Down
2 changes: 1 addition & 1 deletion examples/piano.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn main() {
.add_plugins(DefaultPlugins.set(LogPlugin {
level: Level::WARN,
filter: "bevy_midi=debug".to_string(),
update_subscriber: None,
..default()
}))
.add_plugins(DefaultPickingPlugins)
.add_plugins(MidiInputPlugin)
Expand Down
7 changes: 2 additions & 5 deletions src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,20 @@ impl MidiInputConnection {
/// An [`Event`](bevy::ecs::event::Event) for incoming midi data.
///
/// This event fires from [`CoreStage::PreUpdate`].
#[derive(Resource)]
#[derive(Resource, Event)]
pub struct MidiData {
pub stamp: u64,
pub message: MidiMessage,
}

impl bevy::prelude::Event for MidiData {}

/// The [`Error`] type for midi input operations, accessible as an [`Event`](bevy::ecs::event::Event).
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Event)]
pub enum MidiInputError {
ConnectionError(ConnectErrorKind),
PortRefreshError,
}

impl Error for MidiInputError {}
impl Event for MidiInputError {}
impl Display for MidiInputError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
match self {
Expand Down
3 changes: 1 addition & 2 deletions src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl MidiOutputConnection {
}

/// The [`Error`] type for midi output operations, accessible as an [`Event`](bevy::ecs::event::Event)
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Event)]
pub enum MidiOutputError {
ConnectionError(ConnectErrorKind),
SendError(midir::SendError),
Expand All @@ -108,7 +108,6 @@ pub enum MidiOutputError {
}

impl Error for MidiOutputError {}
impl Event for MidiOutputError {}
impl Display for MidiOutputError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
match self {
Expand Down

0 comments on commit cf7ba52

Please sign in to comment.