diff options
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; |