Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to bevy v0.14 #40

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <bphlox@gmail.com>"]
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 @@
.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 Expand Up @@ -74,8 +74,8 @@
let mut white_key_0: Handle<Mesh> = asset_server.load("models/white_key_0.gltf#Mesh0/Primitive0");
let mut white_key_1: Handle<Mesh> = asset_server.load("models/white_key_1.gltf#Mesh0/Primitive0");
let mut white_key_2: Handle<Mesh> = asset_server.load("models/white_key_2.gltf#Mesh0/Primitive0");
let b_mat = materials.add(Color::rgb(0.1, 0.1, 0.1));

Check warning on line 77 in examples/piano.rs

View workflow job for this annotation

GitHub Actions / Test Suite

use of deprecated associated function `bevy::prelude::Color::rgb`: Use `Color::srgb` instead
let w_mat = materials.add(Color::rgb(1.0, 1.0, 1.0));

Check warning on line 78 in examples/piano.rs

View workflow job for this annotation

GitHub Actions / Test Suite

use of deprecated associated function `bevy::prelude::Color::rgb`: Use `Color::srgb` instead

//Create keyboard layout
let pos_black = pos + Vec3::new(0., 0.06, 0.);
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
Loading