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

Updated to bevy 0.9 #10

Merged
merged 2 commits into from
Nov 13, 2022
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
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_osc"
version = "0.4.0"
version = "0.5.0"
authors = ["Black Phlox <bphlox@gmail.com>"]
edition = "2021"
license = "MIT OR Apache-2.0"
Expand All @@ -23,15 +23,15 @@ name = "bevy_osc"
nannou_osc = "0.18.0"

[dependencies.bevy]
version = "0.8.0"
version = "0.9"
default-features = false

[dev-dependencies.bevy]
version = "0.8.0"
version = "0.9"
features = ["bevy_asset", "render", "bevy_winit"]
default-features = false

[target.'cfg(target_os = "linux")'.dev-dependencies.bevy]
version = "0.8.0"
version = "0.9"
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 @@ -33,6 +33,7 @@ https://user-images.githubusercontent.com/25123512/122121093-81b57300-ce2b-11eb-
|0.6|0.2.X|
|0.7|0.3.X|
|0.8|0.4.X|
|0.9|0.5.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
4 changes: 2 additions & 2 deletions examples/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ fn event_listener_system(mut events: EventReader<OscEvent>) {

//Notice: This is system sends a packet roughly every second, look at the fixed_timestep bevy example for a higher accuracy
fn event_sender_system(events: Option<Res<OscSender>>, time: Res<Time>, mut last_time: Local<f64>) {
let lst = time.seconds_since_startup() - *last_time;
let lst = time.elapsed_seconds_f64() - *last_time;
if lst > 1.0 {
if let Some(sender) = events {
let _ = sender.send(Packet::Message(Message {
addr: "/c".to_string(),
args: Some(vec![Type::Int(1), Type::Int(2), Type::Int(3)]),
}));
}
*last_time = time.seconds_since_startup();
*last_time = time.elapsed_seconds_f64();
}
}
8 changes: 5 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
use bevy::prelude::{App, Commands, Deref, EventWriter, Plugin, Res, ResMut};
use bevy::prelude::{App, Commands, Deref, EventWriter, Plugin, Res, ResMut, Resource};
use nannou_osc as osc;
use osc::{Connected, Receiver, Sender};

#[derive(Resource)]
pub struct OscReceiver {
receiver: Receiver,
}

#[derive(Deref)]
#[derive(Resource, Deref)]
#[allow(dead_code)]
pub struct OscSender {
pub sender: Sender<Connected>,
}

#[derive(Clone)]
#[derive(Resource, Clone)]
pub struct OscLog {
pub received_packets: Vec<(std::net::SocketAddr, osc::Packet)>,
}
Expand All @@ -22,6 +23,7 @@ pub struct OscEvent {
pub packet: osc::Packet,
}

#[derive(Resource)]
pub struct OscSettings {
pub max_log_packets: usize,
pub recv_addr: Option<&'static str>,
Expand Down