commit 38dcbdf5d9d20989d72417bef2a08029b9e21288
Author: Jon Bell <jondbell@protonmail.com>
AuthorDate: Sat Apr 25 16:28:31 2020 -0600
Commit: Jon Bell <jondbell@protonmail.com>
CommitDate: Sat Apr 25 16:28:31 2020 -0600
Fix print behavior that didn't match pico 8
---
source/graphics.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/source/graphics.cpp b/source/graphics.cpp
index 414c8a1..73532bc 100644
--- a/source/graphics.cpp
+++ b/source/graphics.cpp
@@ -438,7 +438,11 @@ void Graphics::rectfill(short x1, short y1, short x2, short y2, uint8_t col) {
}
short Graphics::print(std::string str) {
- return this->print(str, _gfxState_text_x, _gfxState_text_y);
+ short result = this->print(str, _gfxState_text_x, _gfxState_text_y);
+
+ _gfxState_text_y += 6;
+
+ return result;
}
short Graphics::print(std::string str, short x, short y) {
@@ -450,6 +454,7 @@ short Graphics::print(std::string str, short x, short y, uint16_t c) {
color(c);
_gfxState_text_x = x;
+ _gfxState_text_y = y;
for (size_t n = 0; n < str.length(); n++) {
uint8_t ch = str[n];
@@ -467,9 +472,6 @@ short Graphics::print(std::string str, short x, short y, uint16_t c) {
}
}
- _gfxState_text_x = 0;
- _gfxState_text_y = y + 6;
-
//todo: auto scrolling
return x;