mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
Merge pull request #830 from shockham/fix-ball-app-i16-to-isize
Fix ball app compilation updating i16 to isize.
This commit is contained in:
commit
e9c408fbca
1 changed files with 6 additions and 7 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
use gam::menu::api::DrawStyle;
|
|
||||||
use gam::menu::*;
|
use gam::menu::*;
|
||||||
use gam::*;
|
use gam::*;
|
||||||
use locales::t;
|
use locales::t;
|
||||||
|
|
@ -11,9 +10,9 @@ enum BallMode {
|
||||||
Tilt,
|
Tilt,
|
||||||
}
|
}
|
||||||
|
|
||||||
const BALL_RADIUS: i16 = 10;
|
const BALL_RADIUS: isize = 10;
|
||||||
const MOMENTUM_LIMIT: i32 = 8;
|
const MOMENTUM_LIMIT: i32 = 8;
|
||||||
const BORDER_WIDTH: i16 = 5;
|
const BORDER_WIDTH: isize = 5;
|
||||||
pub(crate) struct Ball {
|
pub(crate) struct Ball {
|
||||||
gam: gam::Gam,
|
gam: gam::Gam,
|
||||||
gid: Gid,
|
gid: Gid,
|
||||||
|
|
@ -78,7 +77,7 @@ impl Ball {
|
||||||
screensize,
|
screensize,
|
||||||
_token: token.unwrap(),
|
_token: token.unwrap(),
|
||||||
ball,
|
ball,
|
||||||
momentum: Point::new(x as i16, y as i16),
|
momentum: Point::new(x as isize, y as isize),
|
||||||
trng,
|
trng,
|
||||||
modals,
|
modals,
|
||||||
mode: BallMode::Random,
|
mode: BallMode::Random,
|
||||||
|
|
@ -95,8 +94,8 @@ impl Ball {
|
||||||
draw_list.push(GamObjectType::Circ(self.ball)).unwrap();
|
draw_list.push(GamObjectType::Circ(self.ball)).unwrap();
|
||||||
if self.mode == BallMode::Tilt {
|
if self.mode == BallMode::Tilt {
|
||||||
let (x, y, _z, _id) = self.com.gyro_read_blocking().unwrap();
|
let (x, y, _z, _id) = self.com.gyro_read_blocking().unwrap();
|
||||||
let ix = x as i16;
|
let ix = x as isize;
|
||||||
let iy = y as i16;
|
let iy = y as isize;
|
||||||
log::debug!("x: {}, y: {}", ix, iy);
|
log::debug!("x: {}, y: {}", ix, iy);
|
||||||
// negative x => tilt to right
|
// negative x => tilt to right
|
||||||
// positive x => tilt to left
|
// positive x => tilt to left
|
||||||
|
|
@ -144,7 +143,7 @@ impl Ball {
|
||||||
if hit_bott {
|
if hit_bott {
|
||||||
y = -y.abs();
|
y = -y.abs();
|
||||||
}
|
}
|
||||||
self.momentum = Point::new(x as i16, y as i16);
|
self.momentum = Point::new(x as isize, y as isize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the new location for the ball
|
// draw the new location for the ball
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue