-use common::Point;
+use geometry::{Angle, Point};
use {hashmap, point};
-use common::Radians;
use sdl2::HapticSubsystem;
use sdl2::JoystickSubsystem;
use sdl2::event::Event;
idy: u8,
pub x: f32,
pub y: f32,
- pub a: Radians,
+ pub a: Angle,
}
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 }