Add text shadows
This commit is contained in:
parent
c9ec53952c
commit
0de3b782dc
2 changed files with 6 additions and 1 deletions
|
|
@ -22,8 +22,9 @@ namespace psemek::ui
|
||||||
int inner_margin = 5;
|
int inner_margin = 5;
|
||||||
int outer_margin = 10;
|
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;
|
int text_scale = 1;
|
||||||
|
geom::vector<int, 2> text_shadow_offset{1, 1};
|
||||||
std::shared_ptr<struct font> font;
|
std::shared_ptr<struct font> font;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,10 @@ namespace psemek::ui
|
||||||
auto st = style();
|
auto st = style();
|
||||||
if (!st) return;
|
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)
|
for (auto & g : cached_state_->glyphs)
|
||||||
p.draw_glyph(*(cached_state_->font), g.character, g.position, st->text_color);
|
p.draw_glyph(*(cached_state_->font), g.character, g.position, st->text_color);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue