From 7471347839f30a85e985891b945a721967fcfb86 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Tue, 7 Nov 2017 12:06:19 +0100 Subject: Avoid walking into walls. --- src/render.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/render.cpp') diff --git a/src/render.cpp b/src/render.cpp index 9fb1625..313bc4d 100644 --- a/src/render.cpp +++ b/src/render.cpp @@ -5,7 +5,8 @@ static sf::RectangleShape wot_rect; static sf::Font font; -static void draw_tile(sf::RenderWindow *window, v2f_t x, world::tile_t *tile) +static void draw_tile(sf::RenderWindow *window, v2f_t x, world::tile_t *tile, + world::tile_index_t local) { sf::Texture *texture; @@ -30,7 +31,7 @@ static void draw_tile(sf::RenderWindow *window, v2f_t x, world::tile_t *tile) window->draw(wot_rect); std::stringstream ss; - ss << tile->type << ":" << tile->neighbors; + ss << "L=" << local; sf::Text text(ss.str(), font, 20); text.setPosition(x); text.setScale(0.005, 0.005); @@ -42,7 +43,8 @@ static void draw_sector(sf::RenderWindow *window, world::sector_t *sector) for (ssize_t y = 0; y < SECTOR_SIZE; y++) for (ssize_t x = 0; x < SECTOR_SIZE; x++) draw_tile(window, sector->bounds.v[0] + v2f_t(x, y), - sector->tiles + y * SECTOR_SIZE + x); + sector->tiles + y * SECTOR_SIZE + x, + world::tile_index_t(x, y)); } void interface::state_t::render() -- cgit