Fix warnings when compiling tests.
This commit is contained in:
@@ -120,12 +120,13 @@ pub struct TestbedState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct SceneBuilders(Vec<(&'static str, fn(&mut Testbed))>);
|
struct SceneBuilders(Vec<(&'static str, fn(&mut Testbed))>);
|
||||||
|
|
||||||
|
#[cfg(feature = "other-backends")]
|
||||||
struct OtherBackends {
|
struct OtherBackends {
|
||||||
#[cfg(all(feature = "dim2", feature = "other-backends"))]
|
#[cfg(feature = "dim2")]
|
||||||
box2d: Option<Box2dWorld>,
|
box2d: Option<Box2dWorld>,
|
||||||
#[cfg(all(feature = "dim3", feature = "other-backends"))]
|
#[cfg(feature = "dim3")]
|
||||||
physx: Option<PhysxWorld>,
|
physx: Option<PhysxWorld>,
|
||||||
#[cfg(feature = "other-backends")]
|
|
||||||
nphysics: Option<NPhysicsWorld>,
|
nphysics: Option<NPhysicsWorld>,
|
||||||
}
|
}
|
||||||
struct Plugins(Vec<Box<dyn TestbedPlugin>>);
|
struct Plugins(Vec<Box<dyn TestbedPlugin>>);
|
||||||
@@ -143,6 +144,7 @@ pub struct Testbed<'a, 'b, 'c, 'd> {
|
|||||||
graphics: Option<TestbedGraphics<'a, 'b, 'c, 'd>>,
|
graphics: Option<TestbedGraphics<'a, 'b, 'c, 'd>>,
|
||||||
harness: &'a mut Harness,
|
harness: &'a mut Harness,
|
||||||
state: &'a mut TestbedState,
|
state: &'a mut TestbedState,
|
||||||
|
#[cfg(feature = "other-backends")]
|
||||||
other_backends: &'a mut OtherBackends,
|
other_backends: &'a mut OtherBackends,
|
||||||
plugins: &'a mut Plugins,
|
plugins: &'a mut Plugins,
|
||||||
}
|
}
|
||||||
@@ -152,6 +154,7 @@ pub struct TestbedApp {
|
|||||||
graphics: GraphicsManager,
|
graphics: GraphicsManager,
|
||||||
state: TestbedState,
|
state: TestbedState,
|
||||||
harness: Harness,
|
harness: Harness,
|
||||||
|
#[cfg(feature = "other-backends")]
|
||||||
other_backends: OtherBackends,
|
other_backends: OtherBackends,
|
||||||
plugins: Plugins,
|
plugins: Plugins,
|
||||||
}
|
}
|
||||||
@@ -195,12 +198,12 @@ impl TestbedApp {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let harness = Harness::new_empty();
|
let harness = Harness::new_empty();
|
||||||
|
#[cfg(feature = "other-backends")]
|
||||||
let other_backends = OtherBackends {
|
let other_backends = OtherBackends {
|
||||||
#[cfg(all(feature = "dim2", feature = "other-backends"))]
|
#[cfg(feature = "dim2")]
|
||||||
box2d: None,
|
box2d: None,
|
||||||
#[cfg(all(feature = "dim3", feature = "other-backends"))]
|
#[cfg(feature = "dim3")]
|
||||||
physx: None,
|
physx: None,
|
||||||
#[cfg(feature = "other-backends")]
|
|
||||||
nphysics: None,
|
nphysics: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -210,6 +213,7 @@ impl TestbedApp {
|
|||||||
graphics,
|
graphics,
|
||||||
state,
|
state,
|
||||||
harness,
|
harness,
|
||||||
|
#[cfg(feature = "other-backends")]
|
||||||
other_backends,
|
other_backends,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -291,6 +295,7 @@ impl TestbedApp {
|
|||||||
graphics: None,
|
graphics: None,
|
||||||
state: &mut self.state,
|
state: &mut self.state,
|
||||||
harness: &mut self.harness,
|
harness: &mut self.harness,
|
||||||
|
#[cfg(feature = "other-backends")]
|
||||||
other_backends: &mut self.other_backends,
|
other_backends: &mut self.other_backends,
|
||||||
plugins: &mut self.plugins,
|
plugins: &mut self.plugins,
|
||||||
};
|
};
|
||||||
@@ -407,11 +412,13 @@ impl TestbedApp {
|
|||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
app.add_plugin(bevy_webgl2::WebGL2Plugin);
|
app.add_plugin(bevy_webgl2::WebGL2Plugin);
|
||||||
|
|
||||||
|
#[cfg(feature = "other-backends")]
|
||||||
|
app.insert_non_send_resource(self.other_backends);
|
||||||
|
|
||||||
app.add_startup_system(setup_graphics_environment.system())
|
app.add_startup_system(setup_graphics_environment.system())
|
||||||
.insert_non_send_resource(self.graphics)
|
.insert_non_send_resource(self.graphics)
|
||||||
.insert_resource(self.state)
|
.insert_resource(self.state)
|
||||||
.insert_non_send_resource(self.harness)
|
.insert_non_send_resource(self.harness)
|
||||||
.insert_non_send_resource(self.other_backends)
|
|
||||||
.insert_resource(self.builders)
|
.insert_resource(self.builders)
|
||||||
.insert_non_send_resource(self.plugins)
|
.insert_non_send_resource(self.plugins)
|
||||||
.add_stage_before(CoreStage::Update, "physics", SystemStage::single_threaded())
|
.add_stage_before(CoreStage::Update, "physics", SystemStage::single_threaded())
|
||||||
@@ -843,7 +850,7 @@ fn update_testbed(
|
|||||||
mut graphics: NonSendMut<GraphicsManager>,
|
mut graphics: NonSendMut<GraphicsManager>,
|
||||||
mut state: ResMut<TestbedState>,
|
mut state: ResMut<TestbedState>,
|
||||||
mut harness: NonSendMut<Harness>,
|
mut harness: NonSendMut<Harness>,
|
||||||
mut other_backends: NonSendMut<OtherBackends>,
|
#[cfg(feature = "other-backends")] mut other_backends: NonSendMut<OtherBackends>,
|
||||||
mut plugins: NonSendMut<Plugins>,
|
mut plugins: NonSendMut<Plugins>,
|
||||||
ui_context: Res<EguiContext>,
|
ui_context: Res<EguiContext>,
|
||||||
mut gfx_components: Query<(&mut Transform,)>,
|
mut gfx_components: Query<(&mut Transform,)>,
|
||||||
@@ -936,6 +943,7 @@ fn update_testbed(
|
|||||||
graphics: Some(graphics_context),
|
graphics: Some(graphics_context),
|
||||||
state: &mut *state,
|
state: &mut *state,
|
||||||
harness: &mut *harness,
|
harness: &mut *harness,
|
||||||
|
#[cfg(feature = "other-backends")]
|
||||||
other_backends: &mut *other_backends,
|
other_backends: &mut *other_backends,
|
||||||
plugins: &mut *plugins,
|
plugins: &mut *plugins,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use bevy_egui::{egui, EguiContext};
|
|||||||
pub fn update_ui(ui_context: &EguiContext, state: &mut TestbedState, harness: &mut Harness) {
|
pub fn update_ui(ui_context: &EguiContext, state: &mut TestbedState, harness: &mut Harness) {
|
||||||
egui::Window::new("Parameters").show(ui_context.ctx(), |ui| {
|
egui::Window::new("Parameters").show(ui_context.ctx(), |ui| {
|
||||||
if state.backend_names.len() > 1 && !state.example_names.is_empty() {
|
if state.backend_names.len() > 1 && !state.example_names.is_empty() {
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(all(feature = "dim3", feature = "other-backends"))]
|
||||||
let prev_selected_backend = state.selected_backend;
|
let prev_selected_backend = state.selected_backend;
|
||||||
let mut changed = false;
|
let mut changed = false;
|
||||||
egui::ComboBox::from_label("backend")
|
egui::ComboBox::from_label("backend")
|
||||||
|
|||||||
Reference in New Issue
Block a user