From 8693a266c2c9a8448b70d87d487ed211c439cbc4 Mon Sep 17 00:00:00 2001 From: tom barrett Date: Wed, 19 Jun 2019 04:45:46 -0500 Subject: camera now doesnt display unused map --- src/player.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/player.rs (limited to 'src/player.rs') 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, +} + +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); + } +} -- cgit v1.2.3