X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fcore%2Fcontroller.rs;h=de91928e0fdf2a1a19ad2a1963789198780d3d74;hb=bb3eb700e040846ca793832da4adc133218f2954;hp=54dae94312b07938c385e81106a0c6f3cfc81320;hpb=5d42eba1124851e61be30fde5e26dab1a3e086a5;p=kaka%2Frust-sdl-test.git diff --git a/src/core/controller.rs b/src/core/controller.rs index 54dae94..de91928 100644 --- a/src/core/controller.rs +++ b/src/core/controller.rs @@ -1,6 +1,5 @@ -use common::Point; +use geometry::{Angle, Point}; use {hashmap, point}; -use common::Radians; use sdl2::HapticSubsystem; use sdl2::JoystickSubsystem; use sdl2::event::Event; @@ -67,7 +66,7 @@ pub struct Stick { idy: u8, pub x: f32, pub y: f32, - pub a: Radians, + pub a: Angle, } impl Stick { @@ -80,7 +79,7 @@ impl Stick { Ok(val) => val as f32 / 32768.0, Err(_) => panic!("invalid y axis {}", self.idy), }; - self.a = Radians(self.y.atan2(self.x) as f64); + self.a = point!(self.x as f64, self.y as f64).to_angle(); } #[inline(always)] #[allow(dead_code)] pub fn up(&self) -> bool { self.y < -0.99 }