X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fcore%2Fcontroller.rs;h=1eeb13c9ff1e837d24e8db1101419f1ac89a0ba0;hb=f3fe1a328df7ca0db89ddb14b7d45c3f16cea7fa;hp=9d23257f5a0a567e3f9651c719ed7aaeb588579b;hpb=eca2559123ae3c7ef184bf42ec60680fcddb38f6;p=kaka%2Frust-sdl-test.git diff --git a/src/core/controller.rs b/src/core/controller.rs index 9d23257..1eeb13c 100644 --- a/src/core/controller.rs +++ b/src/core/controller.rs @@ -83,10 +83,10 @@ impl Stick { self.a = Radians(self.y.atan2(self.x) as f64); } - #[inline(always)] #[allow(dead_code)] fn up(&self) -> bool { self.y > 0.99 } - #[inline(always)] #[allow(dead_code)] fn down(&self) -> bool { self.y < -0.99 } - #[inline(always)] #[allow(dead_code)] fn left(&self) -> bool { self.x < -0.99 } - #[inline(always)] #[allow(dead_code)] fn right(&self) -> bool { self.x > 0.99 } + #[inline(always)] #[allow(dead_code)] pub fn up(&self) -> bool { self.y < -0.99 } + #[inline(always)] #[allow(dead_code)] pub fn down(&self) -> bool { self.y > 0.99 } + #[inline(always)] #[allow(dead_code)] pub fn left(&self) -> bool { self.x < -0.99 } + #[inline(always)] #[allow(dead_code)] pub fn right(&self) -> bool { self.x > 0.99 } pub fn to_axis_point(&self) -> Point2D { point!(self.x as f64, self.y as f64) @@ -95,7 +95,7 @@ impl Stick { pub fn to_point(&self) -> Point2D { let p = point!(self.x as f64, self.y as f64); if p.length() > 1.0 { - p.normalize() + p.normalized() } else { p } @@ -216,7 +216,7 @@ fn get_action_mapping() -> HashMap { ActionControls::MovementY => DeviceControls::AxisLY, ActionControls::AimX => DeviceControls::AxisRX, ActionControls::AimY => DeviceControls::AxisRY, - ActionControls::Jump => DeviceControls::ButtonL1, + ActionControls::Jump => DeviceControls::ButtonA, ActionControls::Shoot => DeviceControls::ButtonR1, ActionControls::Start => DeviceControls::ButtonStart )