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,6 +40,9 @@ 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) {
|
||||||
|
if( c == '\n' ) {
|
||||||
|
crlf();
|
||||||
|
} else {
|
||||||
const auto glyph = font.glyph(c);
|
const auto glyph = font.glyph(c);
|
||||||
const auto advance = glyph.advance();
|
const auto advance = glyph.advance();
|
||||||
if( (pos.x + advance.x) > rect.width() ) {
|
if( (pos.x + advance.x) > rect.width() ) {
|
||||||
@ -52,6 +55,7 @@ void Console::write(const std::string message) {
|
|||||||
display.draw_glyph(pos_glyph, glyph, s.foreground, s.background);
|
display.draw_glyph(pos_glyph, glyph, s.foreground, s.background);
|
||||||
pos.x += advance.x;
|
pos.x += advance.x;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::writeln(const std::string message) {
|
void Console::writeln(const std::string message) {
|
||||||
|
Loading…
Reference in New Issue
Block a user