remove plugin callback related code from testbed
This commit is contained in:
@@ -123,7 +123,6 @@ pub struct Testbed {
|
|||||||
graphics: GraphicsManager,
|
graphics: GraphicsManager,
|
||||||
nsteps: usize,
|
nsteps: usize,
|
||||||
camera_locked: bool, // Used so that the camera can remain the same before and after we change backend or press the restart button.
|
camera_locked: bool, // Used so that the camera can remain the same before and after we change backend or press the restart button.
|
||||||
callbacks: Callbacks,
|
|
||||||
plugins: Vec<Box<dyn TestbedPlugin>>,
|
plugins: Vec<Box<dyn TestbedPlugin>>,
|
||||||
hide_counters: bool,
|
hide_counters: bool,
|
||||||
// persistant_contacts: HashMap<ContactId, bool>,
|
// persistant_contacts: HashMap<ContactId, bool>,
|
||||||
@@ -140,10 +139,6 @@ pub struct Testbed {
|
|||||||
nphysics: Option<NPhysicsWorld>,
|
nphysics: Option<NPhysicsWorld>,
|
||||||
}
|
}
|
||||||
|
|
||||||
type Callbacks = Vec<
|
|
||||||
Box<dyn FnMut(&mut Window, &mut PhysicsState, &PhysicsEvents, &mut GraphicsManager, &RunState)>,
|
|
||||||
>;
|
|
||||||
|
|
||||||
impl Testbed {
|
impl Testbed {
|
||||||
pub fn new_empty() -> Testbed {
|
pub fn new_empty() -> Testbed {
|
||||||
let graphics = GraphicsManager::new();
|
let graphics = GraphicsManager::new();
|
||||||
@@ -185,7 +180,6 @@ impl Testbed {
|
|||||||
|
|
||||||
Testbed {
|
Testbed {
|
||||||
builders: Vec::new(),
|
builders: Vec::new(),
|
||||||
callbacks: Vec::new(),
|
|
||||||
plugins: Vec::new(),
|
plugins: Vec::new(),
|
||||||
graphics,
|
graphics,
|
||||||
nsteps: 1,
|
nsteps: 1,
|
||||||
@@ -382,8 +376,6 @@ impl Testbed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn clear(&mut self, window: &mut Window) {
|
fn clear(&mut self, window: &mut Window) {
|
||||||
//FIXME: do we need to do this still, after moving to harness code?
|
|
||||||
self.callbacks.clear();
|
|
||||||
// self.persistant_contacts.clear();
|
// self.persistant_contacts.clear();
|
||||||
// self.state.grabbed_object = None;
|
// self.state.grabbed_object = None;
|
||||||
// self.state.grabbed_object_constraint = None;
|
// self.state.grabbed_object_constraint = None;
|
||||||
@@ -401,16 +393,6 @@ impl Testbed {
|
|||||||
self.plugins.push(Box::new(plugin));
|
self.plugins.push(Box::new(plugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_callback<
|
|
||||||
F: FnMut(&mut Window, &mut PhysicsState, &PhysicsEvents, &mut GraphicsManager, &RunState)
|
|
||||||
+ 'static,
|
|
||||||
>(
|
|
||||||
&mut self,
|
|
||||||
callback: F,
|
|
||||||
) {
|
|
||||||
self.callbacks.push(Box::new(callback));
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn run(mut self) {
|
pub fn run(mut self) {
|
||||||
let mut args = env::args();
|
let mut args = env::args();
|
||||||
let mut benchmark_mode = false;
|
let mut benchmark_mode = false;
|
||||||
@@ -1029,8 +1011,6 @@ impl State for Testbed {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// let physics = &self.harness.physics;
|
|
||||||
|
|
||||||
// Handle UI actions.
|
// Handle UI actions.
|
||||||
{
|
{
|
||||||
let backend_changed = self
|
let backend_changed = self
|
||||||
@@ -1291,11 +1271,7 @@ impl State for Testbed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for plugin in &mut self.plugins {
|
for plugin in &mut self.plugins {
|
||||||
plugin.run_callbacks(
|
plugin.run_callbacks(window, &mut self.harness.physics, &self.harness.state);
|
||||||
window,
|
|
||||||
&mut self.harness.physics,
|
|
||||||
&self.harness.state,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if true {
|
// if true {
|
||||||
|
|||||||
Reference in New Issue
Block a user