mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-09 23:22:33 -04:00
"Labels" widget
This commit is contained in:
parent
0102a34286
commit
d12cd0d8af
11 changed files with 52 additions and 74 deletions
|
@ -42,11 +42,14 @@ int Painter::draw_char(const Point p, const Style& style, const char c) {
|
|||
return glyph.advance().x();
|
||||
}
|
||||
|
||||
int Painter::draw_string(Point p, const Style& style, const std::string text) {
|
||||
int Painter::draw_string(Point p, const Font& font, const Color foreground,
|
||||
const Color background, const std::string text) {
|
||||
|
||||
size_t width = 0;
|
||||
|
||||
for(const auto c : text) {
|
||||
const auto glyph = style.font.glyph(c);
|
||||
display.draw_glyph(p, glyph, style.foreground, style.background);
|
||||
const auto glyph = font.glyph(c);
|
||||
display.draw_glyph(p, glyph, foreground, background);
|
||||
const auto advance = glyph.advance();
|
||||
p += advance;
|
||||
width += advance.x();
|
||||
|
@ -54,6 +57,10 @@ int Painter::draw_string(Point p, const Style& style, const std::string text) {
|
|||
return width;
|
||||
}
|
||||
|
||||
int Painter::draw_string(Point p, const Style& style, const std::string text) {
|
||||
return draw_string(p, style.font, style.foreground, style.background, text);
|
||||
}
|
||||
|
||||
void Painter::draw_bitmap(const Point p, const Bitmap& bitmap, const Color foreground, const Color background) {
|
||||
display.draw_bitmap(p, bitmap.size, bitmap.data, foreground, background);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue