//! A minimal example setting up bevy_rosc without the plugin extern crate bevy_rosc; use std::time::Duration; use bevy::prelude::*; use bevy::time::common_conditions::on_timer; use bevy_rosc::OscDispatcher; use bevy_rosc::OscMethod; use bevy_rosc::{method_dispatcher_system, MultiAddressOscMethod, OscDispatchEvent}; use rosc::OscMessage; use rosc::OscPacket; fn startup(mut commands: Commands) { println!("** Startup"); for i in 0..3 { commands.spawn(MultiAddressOscMethod::new(vec![format!("/entity{}/time", i)]).unwrap()); } } /// System that listens for any `MultiAddressOscMethod` that has changed and then prints out the received OscMessage fn print_received_osc_packets( mut query: Query<&mut MultiAddressOscMethod, Changed>, ) { for mut osc_method in query.iter_mut() { let new_msg = osc_method.get_message(); if let Some(msg) = new_msg { println!( "Method {:?} received: {:?}", osc_method.get_addresses()[0], msg ) } } } /// Create an `OscMessage` and then dispatch it /// This would usually be replaced with receiving messages from an UDP server or similar fn send_message( mut disp: ResMut, time: Res