foxygit / fake-08-xbox360 Log in
commit 6c5203f9ee2d87ed9e84416a13a9cd7ffccb695b
Author:     Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Wed Aug 17 19:06:41 2022 -0600
Commit:     Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Wed Aug 17 19:06:41 2022 -0600

    Fix some text wrapping bugs

    use homeX as x start
    fix setting draw state cursor y location + lineheight at end
---
 source/printHelper.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/source/printHelper.cpp b/source/printHelper.cpp
index 79dcfab..eb6a7ba 100644
--- a/source/printHelper.cpp
+++ b/source/printHelper.cpp
@@ -327,7 +327,7 @@ int print(std::string str, int x, int y, uint8_t c) {
 			_ph_mem->drawState.drawPaletteMap[7] = _ph_graphics->getDrawPalMappedColor(fgColor);
 		}
 		else if (ch == '\n') {
-			x = _ph_mem->drawState.text_x;
+			x = homeX;
 			y += lineHeight;
 		}
 		else if (ch == '\t') {
@@ -339,7 +339,7 @@ int print(std::string str, int x, int y, uint8_t c) {
 			x -= charWidth;
 		}
 		else if (ch == '\r') {
-			x = _ph_mem->drawState.text_x;
+			x = homeX;
 		}
 		else if (ch >= 0x10) {
             if (bgColor != 0) {
@@ -357,7 +357,7 @@ int print(std::string str, int x, int y, uint8_t c) {

         //soft wrap if enabled
         if (rhsWrap > 0 && x >= rhsWrap) {
-            x = _ph_mem->drawState.text_x;
+            x = homeX;
 			y += lineHeight;
         }
 	}
@@ -367,7 +367,7 @@ int print(std::string str, int x, int y, uint8_t c) {
 	}

 	//todo: auto scrolling
-	_ph_mem->drawState.text_y += lineHeight;
+	_ph_mem->drawState.text_y = y + lineHeight;

 	return x;
 }
\ No newline at end of file