Add text shadows

This commit is contained in:
Nikita Lisitsa 2021-02-26 11:36:32 +03:00
parent c9ec53952c
commit 0de3b782dc
2 changed files with 6 additions and 1 deletions

View file

@ -22,8 +22,9 @@ namespace psemek::ui
int inner_margin = 5;
int outer_margin = 10;
gfx::color_rgba text_color{0, 0, 0, 255};
gfx::color_rgba text_color{255, 255, 255, 255};
int text_scale = 1;
geom::vector<int, 2> text_shadow_offset{1, 1};
std::shared_ptr<struct font> font;
};

View file

@ -60,6 +60,10 @@ namespace psemek::ui
auto st = style();
if (!st) return;
if (st->text_shadow_offset != geom::vector{0, 0})
for (auto & g : cached_state_->glyphs)
p.draw_glyph(*(cached_state_->font), g.character, g.position + geom::cast<float>(st->text_shadow_offset), st->shadow_color);
for (auto & g : cached_state_->glyphs)
p.draw_glyph(*(cached_state_->font), g.character, g.position, st->text_color);
}