Dolda2000 GitWeb
/
kaka
/
rust-sdl-test.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Point2D -> Point
[kaka/rust-sdl-test.git]
/
src
/
core
/
game.rs
diff --git
a/src/core/game.rs
b/src/core/game.rs
index
36e6ed5
..
eabbdf9
100644
(file)
--- a/
src/core/game.rs
+++ b/
src/core/game.rs
@@
-1,6
+1,6
@@
use ActiveState;
use AppState;
use ActiveState;
use AppState;
-use common::{Point
2D
, Radians};
+use common::{Point, Radians};
use core::app::StateChange;
use core::controller::Controller;
use core::controller::ControllerManager;
use core::app::StateChange;
use core::controller::Controller;
use core::controller::ControllerManager;
@@
-145,8
+145,8
@@
pub trait Drawable {}
pub struct Character {
ctrl: Rc<RefCell<Controller>>,
pub struct Character {
ctrl: Rc<RefCell<Controller>>,
- pos: Point
2D
<f64>,
- vel: Point
2D
<f64>,
+ pos: Point<f64>,
+ vel: Point<f64>,
}
impl Character {
}
impl Character {
@@
-237,7
+237,7
@@
impl Object for Character {
renderer.draw_line(pos, p, (0, 255, 0));
draw_cross(renderer, p);
// // circle values
renderer.draw_line(pos, p, (0, 255, 0));
draw_cross(renderer, p);
// // circle values
- // let p = (self.pos + Point
2D
::from(ctrl.aim.a) * l).to_i32().into();
+ // let p = (self.pos + Point::from(ctrl.aim.a) * l).to_i32().into();
// renderer.draw_line(pos, p, (0, 0, 255));
// draw_cross(renderer, p);
}
// renderer.draw_line(pos, p, (0, 0, 255));
// draw_cross(renderer, p);
}
@@
-251,8
+251,8
@@
fn draw_cross(renderer: &mut Renderer, p: (i32, i32)) {
////////// BOLL ////////////////////////////////////////////////////////////////
pub struct Boll {
////////// BOLL ////////////////////////////////////////////////////////////////
pub struct Boll {
- pos: Point
2D
<f64>,
- vel: Point
2D
<f64>,
+ pos: Point<f64>,
+ vel: Point<f64>,
bounces: u8,
}
bounces: u8,
}
@@
-274,7
+274,7
@@
impl Object for Boll {
let mut rng = rand::thread_rng();
let a = Radians(self.vel.to_radians().0 + Normal::new(0.0, 0.75).sample(&mut rng));
objects.push(Box::new(Boll {
let mut rng = rand::thread_rng();
let a = Radians(self.vel.to_radians().0 + Normal::new(0.0, 0.75).sample(&mut rng));
objects.push(Box::new(Boll {
- vel: Point
2D
::from(a) * Normal::new(1.0, 0.25).sample(&mut rng) * self.vel.length(),
+ vel: Point::from(a) * Normal::new(1.0, 0.25).sample(&mut rng) * self.vel.length(),
..*self
}));
}
..*self
}));
}