Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 1560a5eff8d8d9d24c42f5e41787bdbc5408d701 Mon Sep 17 00:00:00 2001
- From: Tom Jakubowski <tom@crystae.net>
- Date: Fri, 10 Jul 2015 17:11:54 -0700
- Subject: [PATCH] Make it build on stable
- ---
- src/main.rs | 2 --
- src/models/player.rs | 17 +++++++++--------
- 2 files changed, 9 insertions(+), 10 deletions(-)
- diff --git a/src/main.rs b/src/main.rs
- index 01f73a3..d5ad15f 100644
- --- a/src/main.rs
- +++ b/src/main.rs
- @@ -1,5 +1,3 @@
- -#![feature(associated_consts)]
- -
- extern crate glutin_window;
- extern crate graphics;
- extern crate itertools;
- diff --git a/src/models/player.rs b/src/models/player.rs
- index 872d36b..1cd66f6 100644
- --- a/src/models/player.rs
- +++ b/src/models/player.rs
- @@ -14,14 +14,15 @@ pub struct Player {
- derive_position_direction!(Player);
- +const PLAYER_POLYGON: &'static [[f64; 2]] = &[
- + [0.0, -8.0],
- + [20.0, 0.0],
- + [0.0, 8.0]
- +];
- +
- +
- impl Player {
- /// The player is drawn as the triangle below
- - const POLYGON: &'static [[f64; 2]] = &[
- - [0.0, -8.0],
- - [20.0, 0.0],
- - [0.0, 8.0]
- - ];
- -
- /// Create a new `Player` with a random position and direction
- pub fn random<R: Rng>(rng: &mut R, bounds: Size) -> Player {
- Player { vector: Vector::random(rng, bounds) }
- @@ -34,12 +35,12 @@ impl Player {
- .rot_rad(self.direction());
- // Draw a rectangle on the position of the player
- - Polygon::new(color::RED).draw(Player::POLYGON, &c.draw_state, transform, gl);
- + Polygon::new(color::RED).draw(PLAYER_POLYGON, &c.draw_state, transform, gl);
- }
- /// Returns the nose of the rocket
- pub fn nose(&self) -> Point {
- - Point::new(Player::POLYGON[1][0], Player::POLYGON[1][1])
- + Point::new(PLAYER_POLYGON[1][0], PLAYER_POLYGON[1][1])
- .rotate(self.direction())
- .translate(&self.position())
- }
- --
- 2.3.2 (Apple Git-55)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement