summaryrefslogtreecommitdiff
path: root/src/render.cpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-11-07 12:41:23 +0100
committerPaweł Redman <pawel.redman@gmail.com>2017-11-07 12:41:23 +0100
commite28a62894f368cccc64932fe83c91f32d7cb7288 (patch)
tree63588a2791d1fa474327807b9185f864d1e2974e /src/render.cpp
parent7471347839f30a85e985891b945a721967fcfb86 (diff)
Hide debug draws by default, start working on selecting.
Diffstat (limited to 'src/render.cpp')
-rw-r--r--src/render.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/render.cpp b/src/render.cpp
index 313bc4d..41bcd4b 100644
--- a/src/render.cpp
+++ b/src/render.cpp
@@ -29,13 +29,16 @@ static void draw_tile(sf::RenderWindow *window, v2f_t x, world::tile_t *tile,
wot_rect.setFillColor(sf::Color::White);
wot_rect.setOutlineColor(sf::Color::Transparent);
window->draw(wot_rect);
+ wot_rect.setTexture(NULL);
- std::stringstream ss;
- ss << "L=" << local;
- sf::Text text(ss.str(), font, 20);
- text.setPosition(x);
- text.setScale(0.005, 0.005);
- window->draw(text);
+ if (debug_draw_tile_coords) {
+ std::stringstream ss;
+ ss << "L=" << local;
+ sf::Text text(ss.str(), font, 20);
+ text.setPosition(x);
+ text.setScale(0.005, 0.005);
+ window->draw(text);
+ }
}
static void draw_sector(sf::RenderWindow *window, world::sector_t *sector)
@@ -49,6 +52,14 @@ static void draw_sector(sf::RenderWindow *window, world::sector_t *sector)
void interface::state_t::render()
{
+ if (select.selecting) {
+ wot_rect.setSize(select.rect.dims());
+ wot_rect.setPosition(select.rect[0]);
+ wot_rect.setFillColor(sf::Color(200, 100, 50, 100));
+ wot_rect.setOutlineThickness(0.02f);
+ wot_rect.setOutlineColor(sf::Color(200, 100, 50, 255));
+ window->draw(wot_rect);
+ }
}
namespace render {
@@ -147,15 +158,9 @@ void state_t::render(game::state_t *game)
for (world::entity_t *ent : ents) {
ent->render_to(this);
- drender_entity(ent);
- }
- for (world::world_t::debug_t &debug : game->world.debug) {
- sf::Text text(debug.text, font, 20);
- text.setPosition(debug.x);
- text.setScale(0.006, 0.006);
- text.setFillColor(sf::Color::Red);
- window->draw(text);
+ if (debug_draw_cmodels)
+ drender_entity(ent);
}
}