From 8d6cb03cd83b9f6576909058601af54f16c8acfe Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Mon, 9 Oct 2017 19:24:08 +0200 Subject: Refactoring and basic map generation. --- src/render.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/render.cpp') diff --git a/src/render.cpp b/src/render.cpp index 218dff0..05785ae 100644 --- a/src/render.cpp +++ b/src/render.cpp @@ -7,7 +7,7 @@ static void draw_tile(sf::RenderWindow *window, float x, float y, { wot_rect.setSize(sf::Vector2f(1.0f, 1.0f)); wot_rect.setPosition(sf::Vector2f(x, y)); - wot_rect.setFillColor(sf::Color(tile->type, 255 - tile->type, tile->type + 128)); + wot_rect.setFillColor(sf::Color(tile->type, tile->type, tile->type)); wot_rect.setOutlineColor(sf::Color::Transparent); window->draw(wot_rect); } @@ -28,14 +28,14 @@ static void draw_sector(sf::RenderWindow *window, world::world_t *world, } wot_rect.setSize(sf::Vector2f(SECTOR_SIZE, SECTOR_SIZE)); - wot_rect.setPosition(sf::Vector2f(index.x * 16, index.y * 16)); + wot_rect.setPosition(sf::Vector2f(index.x * SECTOR_SIZE, index.y * SECTOR_SIZE)); wot_rect.setOutlineColor(sf::Color::Yellow); wot_rect.setOutlineThickness(0.06f); wot_rect.setFillColor(sf::Color::Transparent); window->draw(wot_rect); } -void world::world_t::render(sf::RenderWindow *window) +void game::state_t::render(sf::RenderWindow *window) { sf::Vector2u size = window->getSize(); sf::Vector2f A, B, C, D; @@ -59,7 +59,7 @@ void world::world_t::render(sf::RenderWindow *window) for (ssize_t y = index_box.top; y < index_box.height; y++) for (ssize_t x = index_box.left; x < index_box.width; x++) - draw_sector(window, this, world::sector_index_t(x, y)); + draw_sector(window, &world, world::sector_index_t(x, y)); } void interface::state_t::render() -- cgit