|
@@ -1,6 +1,6 @@
|
|
|
+use crate::types::World;
|
|
|
use specs::world::WorldExt;
|
|
|
use specs::{Component, NullStorage, VecStorage};
|
|
|
-use crate::types::World;
|
|
|
|
|
|
/// Register all the components with the world.
|
|
|
pub fn register(world: &mut specs::World) {
|
|
@@ -121,7 +121,8 @@ pub struct Blocking {
|
|
|
impl Blocking {
|
|
|
/// create a `Blocking` component for an entity given a specified shape
|
|
|
pub fn new_shape<S>(e: specs::Entity, w: &mut World, volume: S) -> Blocking
|
|
|
- where S: ncollide2d::shape::Shape<f32>
|
|
|
+ where
|
|
|
+ S: ncollide2d::shape::Shape<f32>,
|
|
|
{
|
|
|
let (handle, _) = w.add(
|
|
|
nalgebra::geometry::Isometry::identity(),
|
|
@@ -130,16 +131,16 @@ impl Blocking {
|
|
|
ncollide2d::pipeline::object::GeometricQueryType::Proximity(0.0),
|
|
|
e,
|
|
|
);
|
|
|
- Blocking {
|
|
|
- handle,
|
|
|
- }
|
|
|
+ Blocking { handle }
|
|
|
}
|
|
|
|
|
|
/// create an 11pxx11px box for an entity
|
|
|
pub fn new_box(e: specs::Entity, w: &mut World) -> Blocking {
|
|
|
- Blocking::new_shape(e, w, ncollide2d::shape::Cuboid::new(nalgebra::Vector2::new(
|
|
|
- 11.0, 11.0,
|
|
|
- )))
|
|
|
+ Blocking::new_shape(
|
|
|
+ e,
|
|
|
+ w,
|
|
|
+ ncollide2d::shape::Cuboid::new(nalgebra::Vector2::new(11.0, 11.0)),
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
/// create a 11px ball for an entity
|