Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. From 1560a5eff8d8d9d24c42f5e41787bdbc5408d701 Mon Sep 17 00:00:00 2001
  2. From: Tom Jakubowski <tom@crystae.net>
  3. Date: Fri, 10 Jul 2015 17:11:54 -0700
  4. Subject: [PATCH] Make it build on stable
  5.  
  6. ---
  7. src/main.rs | 2 --
  8. src/models/player.rs | 17 +++++++++--------
  9. 2 files changed, 9 insertions(+), 10 deletions(-)
  10.  
  11. diff --git a/src/main.rs b/src/main.rs
  12. index 01f73a3..d5ad15f 100644
  13. --- a/src/main.rs
  14. +++ b/src/main.rs
  15. @@ -1,5 +1,3 @@
  16. -#![feature(associated_consts)]
  17. -
  18. extern crate glutin_window;
  19. extern crate graphics;
  20. extern crate itertools;
  21. diff --git a/src/models/player.rs b/src/models/player.rs
  22. index 872d36b..1cd66f6 100644
  23. --- a/src/models/player.rs
  24. +++ b/src/models/player.rs
  25. @@ -14,14 +14,15 @@ pub struct Player {
  26.  
  27. derive_position_direction!(Player);
  28.  
  29. +const PLAYER_POLYGON: &'static [[f64; 2]] = &[
  30. + [0.0, -8.0],
  31. + [20.0, 0.0],
  32. + [0.0, 8.0]
  33. +];
  34. +
  35. +
  36. impl Player {
  37. /// The player is drawn as the triangle below
  38. - const POLYGON: &'static [[f64; 2]] = &[
  39. - [0.0, -8.0],
  40. - [20.0, 0.0],
  41. - [0.0, 8.0]
  42. - ];
  43. -
  44. /// Create a new `Player` with a random position and direction
  45. pub fn random<R: Rng>(rng: &mut R, bounds: Size) -> Player {
  46. Player { vector: Vector::random(rng, bounds) }
  47. @@ -34,12 +35,12 @@ impl Player {
  48. .rot_rad(self.direction());
  49.  
  50. // Draw a rectangle on the position of the player
  51. - Polygon::new(color::RED).draw(Player::POLYGON, &c.draw_state, transform, gl);
  52. + Polygon::new(color::RED).draw(PLAYER_POLYGON, &c.draw_state, transform, gl);
  53. }
  54.  
  55. /// Returns the nose of the rocket
  56. pub fn nose(&self) -> Point {
  57. - Point::new(Player::POLYGON[1][0], Player::POLYGON[1][1])
  58. + Point::new(PLAYER_POLYGON[1][0], PLAYER_POLYGON[1][1])
  59. .rotate(self.direction())
  60. .translate(&self.position())
  61. }
  62. --
  63. 2.3.2 (Apple Git-55)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement