diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2017-12-14 14:09:07 +0100 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2017-12-14 14:09:07 +0100 |
commit | 154004ae6ac3747769648511cdc77e7171c684d8 (patch) | |
tree | a85cd8be5ee9c83e31f028ee9ffdf0ea1269e4ce /src/render.cpp | |
parent | 12143c33141a9c35e8eb01609062655f560b4bc1 (diff) |
The gamelog, being reworking combat.
Diffstat (limited to 'src/render.cpp')
-rw-r--r-- | src/render.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/render.cpp b/src/render.cpp index cddb6c9..2f1890e 100644 --- a/src/render.cpp +++ b/src/render.cpp @@ -1,23 +1,15 @@ #include "common.hpp" -#include <list> -#include <sstream> static sf::RectangleShape wot_rect; static sf::Font font; -void interface::state_t::render_to(render::state_t *render) -{ - if (select.selecting) - render->render_hlrect(select.rect, sf::Color(200, 100, 50)); -} - namespace render { state_t::state_t(sf::RenderWindow *window_) { window = window_; - font.loadFromFile("assets/LiberationMono-Regular.ttf"); + font.loadFromFile("assets/FanwoodText.otf"); } // FIXME: rename @@ -190,18 +182,22 @@ void state_t::render(oriented_sprite_t *sprite, rectf_t bounds, float angle) render(sprite->textures + index, bounds, mirror); } -void state_t::render_text(v2f_t x, float height, const wchar_t *wstr, +void state_t::render_text(v2f_t x, float height, std::string str, text_align_t align, sf::Color color) { - sf::Text text(wstr, font, 20); + sf::Text text(str, font, 40); sf::FloatRect rect; float scale; v2f_t offset; rect = text.getGlobalBounds(); - scale = height / 20.0f; + scale = height / 40.0f; switch (align) { + case ALIGN_LEFT_TOP: + offset = v2f_t(0, 0); + break; + case ALIGN_CENTER_BOTTOM: offset[0] = -rect.width / 2; offset[1] = -rect.height; |