use bevy::prelude::*;
use bevy_brp_extras::BrpExtrasPlugin;
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(bevy::window::WindowPlugin {
primary_window: Some(bevy::window::Window {
title: "Format Discovery Test".to_string(),
resolution: (400.0, 300.0).into(),
..default()
}),
..default()
}))
.add_plugins(BrpExtrasPlugin::new())
.add_systems(Startup, setup_test_entities)
.add_systems(Update, keep_running)
.run();
}
fn setup_test_entities(mut commands: Commands) {
info!("Setting up test entities for format discovery...");
commands.spawn((Transform::from_xyz(1.0, 2.0, 3.0), Name::new("TestEntity1")));
commands.spawn((
Transform::from_scale(Vec3::splat(2.0)),
Name::new("ScaledEntity"),
));
commands.spawn((
Transform {
translation: Vec3::new(10.0, 20.0, 30.0),
rotation: Quat::from_rotation_y(std::f32::consts::PI / 4.0),
scale: Vec3::new(0.5, 1.5, 2.0),
},
Name::new("ComplexTransformEntity"),
));
commands.spawn((
Transform::from_xyz(0.0, 0.0, 0.0),
Name::new("VisibleEntity"),
Visibility::default(),
));
info!("Test entities spawned successfully!");
info!("BRP server should be running on http://localhost:15702");
info!("Test format discovery with:");
info!(" curl -X POST http://localhost:15702/brp_extras/discover_format \\");
info!(r#" -H "Content-Type: application/json" \"#);
info!(r#" -d '{{"types": ["bevy_transform::components::transform::Transform"]}}'""#);
info!("Or with multiple types:");
info!(" curl -X POST http://localhost:15702/brp_extras/discover_format \\");
info!(r#" -H "Content-Type: application/json" \"#);
info!(
r#" -d '{{"types": ["bevy_transform::components::transform::Transform", "bevy_core::name::Name"]}}'""#
);
}
#[allow(clippy::needless_pass_by_value)] fn keep_running(time: Res<Time>) {
if time.elapsed_secs() % 10.0 < time.delta_secs() {
info!("App running... BRP server available at http://localhost:15702");
}
}