diff --git a/pong/src/collision.rs b/pong/src/collision.rs index 01c20f4..82307a6 100644 --- a/pong/src/collision.rs +++ b/pong/src/collision.rs @@ -1,4 +1,5 @@ pub mod collision { + use std::fmt::Debug; use crate::game_object::game_object::GameObject; pub struct CollisionDetector {} @@ -35,11 +36,12 @@ pub mod collision { } } - pub trait CollisionRegistry { + pub trait CollisionRegistry : Debug { fn get_collisions(&self) -> Vec<&Collision>; fn get_collisions_by_id(&self, id: u16) -> Vec<&Collision>; } + #[derive(Debug)] pub struct Collisions { pub state: Vec, } diff --git a/pong/src/game_field.rs b/pong/src/game_field.rs index bed8315..21cf93c 100644 --- a/pong/src/game_field.rs +++ b/pong/src/game_field.rs @@ -21,7 +21,7 @@ pub struct Field { pub players: Vec, pub balls: Vec, pub bounds: Bounds, - collisions: Box + pub collisions: Box } impl Field { diff --git a/src/lib.rs b/src/lib.rs index 9810f38..53a5c18 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -113,6 +113,7 @@ impl FieldWrapper { let input_dtos: Vec = inputs_js.into_serde().unwrap(); let inputs = input_dtos.into_iter().map(|i| i.to_input()).collect::>(); self.field.tick(inputs); + log!("{:?}", self.field.collisions); } pub fn objects(&self) -> *const GameObjectDTO {