summaryrefslogtreecommitdiff
path: root/src/player.rs
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2019-06-19 04:45:46 -0500
committertom barrett <spalf0@gmail.com>2019-06-19 04:45:46 -0500
commit8693a266c2c9a8448b70d87d487ed211c439cbc4 (patch)
tree3330eeba26d6f5f65b7625c49215e54cd5394271 /src/player.rs
parent0567e86e184684ace269edad903a740e6f2f4024 (diff)
camera now doesnt display unused map
Diffstat (limited to 'src/player.rs')
-rw-r--r--src/player.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/player.rs b/src/player.rs
new file mode 100644
index 0000000..66e7d28
--- /dev/null
+++ b/src/player.rs
@@ -0,0 +1,26 @@
+use ggez::graphics::{spritebatch::SpriteBatch, DrawParam};
+use ggez::nalgebra::{Point2, Vector2};
+
+use crate::constants;
+use crate::tileset::Tileset;
+
+pub struct Player {
+ pub position: Point2<f32>,
+}
+
+impl Player {
+ pub fn new() -> Player {
+ Player {
+ position: Point2::new(0.0, 0.0),
+ }
+ }
+
+ pub fn draw(&self, spritebatch: &mut SpriteBatch, tileset: &Tileset) {
+ let draw_param = DrawParam::default()
+ .src(tileset.tiles[1])
+ .dest(self.position)
+ .scale(Vector2::new(constants::TILE_SCALE, constants::TILE_SCALE));
+
+ spritebatch.add(draw_param);
+ }
+}