New boll - CircleBoll
[kaka/rust-sdl-test.git] / src / main.rs
index 0cb2ecf..d99da89 100644 (file)
@@ -22,7 +22,7 @@ use sdl2::video::Window;
 use sdl2::video::WindowContext;
 use time::PreciseTime;
 
-use boll::{Boll, SquareBoll};
+use boll::{Boll, SquareBoll, CircleBoll};
 use common::Point2D;
 
 #[macro_use] mod common;
@@ -125,10 +125,12 @@ fn main() {
                 }
                 Event::KeyDown { keycode: Some(Keycode::KpPlus), .. } => { boll_size = std::cmp::min(boll_size + 1, 32) }
                 Event::KeyDown { keycode: Some(Keycode::KpMinus), .. } => { boll_size = std::cmp::max(boll_size - 1, 1) }
-                Event::MouseMotion { x, y, .. } => { bolls.push(Box::new(SquareBoll {
-                    pos: point!(x as f64, y as f64),
-                    vel: point!(0.0, 0.0),
-                })) }
+                Event::MouseMotion { x, y, .. } => {
+                    bolls.push(Box::new(CircleBoll::new(
+                        point!(x as f64, y as f64),
+                        point!(0.0, 0.0),
+                    )))
+                }
                 _ => {}
             }
         }