diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2017-10-09 19:24:08 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2017-10-09 19:24:08 +0200 |
commit | 8d6cb03cd83b9f6576909058601af54f16c8acfe (patch) | |
tree | 1aae264859680e888c5801f279b638cefa137fb9 /src/render.cpp | |
parent | 9e7d64d052eabcf40d85c3e903aaba44903a380a (diff) |
Refactoring and basic map generation.
Diffstat (limited to 'src/render.cpp')
-rw-r--r-- | src/render.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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() |