summaryrefslogtreecommitdiff
path: root/src/state.rs
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2019-06-22 10:11:18 -0500
committertom barrett <spalf0@gmail.com>2019-06-22 10:11:18 -0500
commitcccfb66c7c58bf464252e942ef2b742b41ece19e (patch)
tree8d13331a5cb65343d1a668d6dbb3fa4a62fb598a /src/state.rs
parent99c6e61a2b8fe66dcef7eada525f6fbdd7a2cd00 (diff)
now draw at the tile level
Diffstat (limited to 'src/state.rs')
-rw-r--r--src/state.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/state.rs b/src/state.rs
index b0a497c..20066a8 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -9,7 +9,7 @@ use crate::tileset::Tileset;
pub struct State {
map: Map,
- tileset: Tileset,
+ //tileset: Tileset,
spritebatch: SpriteBatch,
camera: Camera,
player: Player,
@@ -20,12 +20,14 @@ impl State {
let mut image = Image::new(context, "/tileset.png")?;
image.set_filter(FilterMode::Nearest);
- let map = Map::new(filesystem::open(context, "/map.tmx")?);
+ let tileset = Tileset::new(filesystem::open(context, "/tileset.tsx")?);
+
+ let map = Map::new(filesystem::open(context, "/map.tmx")?, &tileset);
let map_dimensions = map.get_dimensions();
Ok(State {
map,
- tileset: Tileset::new(filesystem::open(context, "/tileset.tsx")?),
+ // tileset,
spritebatch: SpriteBatch::new(image),
camera: Camera::new(context, map_dimensions),
player: Player::new(map_dimensions),
@@ -43,7 +45,7 @@ impl EventHandler for State {
fn draw(&mut self, context: &mut Context) -> GameResult {
graphics::clear(context, graphics::BLACK);
- self.map.draw(&mut self.spritebatch, &self.tileset);
+ self.map.draw(&mut self.spritebatch);
self.player.draw(&mut self.spritebatch);
graphics::draw(