diff options
Diffstat (limited to 'src/player.rs')
-rw-r--r-- | src/player.rs | 26 |
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); + } +} |