mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-25 23:39:37 -05:00
Implement console "\n" -> crlf() behavior.
This commit is contained in:
parent
32319ddf9f
commit
ec977ccd05
@ -40,17 +40,21 @@ void Console::write(const std::string message) {
|
|||||||
const Font& font = s.font;
|
const Font& font = s.font;
|
||||||
const auto rect = screen_rect();
|
const auto rect = screen_rect();
|
||||||
for(const auto c : message) {
|
for(const auto c : message) {
|
||||||
const auto glyph = font.glyph(c);
|
if( c == '\n' ) {
|
||||||
const auto advance = glyph.advance();
|
|
||||||
if( (pos.x + advance.x) > rect.width() ) {
|
|
||||||
crlf();
|
crlf();
|
||||||
|
} else {
|
||||||
|
const auto glyph = font.glyph(c);
|
||||||
|
const auto advance = glyph.advance();
|
||||||
|
if( (pos.x + advance.x) > rect.width() ) {
|
||||||
|
crlf();
|
||||||
|
}
|
||||||
|
const Point pos_glyph {
|
||||||
|
static_cast<Coord>(rect.pos.x + pos.x),
|
||||||
|
display.scroll_area_y(pos.y)
|
||||||
|
};
|
||||||
|
display.draw_glyph(pos_glyph, glyph, s.foreground, s.background);
|
||||||
|
pos.x += advance.x;
|
||||||
}
|
}
|
||||||
const Point pos_glyph {
|
|
||||||
static_cast<Coord>(rect.pos.x + pos.x),
|
|
||||||
display.scroll_area_y(pos.y)
|
|
||||||
};
|
|
||||||
display.draw_glyph(pos_glyph, glyph, s.foreground, s.background);
|
|
||||||
pos.x += advance.x;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user