From 3246aa2d650152c4d7fa53e668cb26fb746f6633 Mon Sep 17 00:00:00 2001 From: ocawesome101 Date: Fri, 28 May 2021 13:19:44 -0400 Subject: [PATCH] ha! fixed it, mostly... now to make colors work --- src/lua/core/textgpu.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lua/core/textgpu.lua b/src/lua/core/textgpu.lua index 0ec50ff..14d7013 100644 --- a/src/lua/core/textgpu.lua +++ b/src/lua/core/textgpu.lua @@ -59,10 +59,11 @@ local function set(x, y, text, f, b, safe) b = b or bg local len = utf8.len(text) if x + len > w then - text = unsub(text, 1, -1 - ((x + len) - w)) + --len = (x + len) - w + --text = unsub(text, 1, len) end - tbuffer[y] = tbuffer[y]:sub(1, x - 1) .. - text .. tbuffer[y]:sub(x + len) + tbuffer[y] = unsub(tbuffer[y], 1, x - 1) .. + text .. unsub(tbuffer[y], x + len) if type(f) == "string" then fbuffer[y] = fbuffer[y]:sub(1, x - 1) .. f .. fbuffer[y]:sub(x + len) @@ -81,7 +82,7 @@ local function set(x, y, text, f, b, safe) bbuffer[y] = bbuffer[y]:sub(1, x - 1) .. string.rep(string.char(b - 1), len) .. bbuffer[y]:sub(x + len) end - write("\27[", x, ";", y, "H", text) + write("\27[", y, ";", x, "H", text) flush() end @@ -222,6 +223,7 @@ function textgpu.start() checkArg(2, y, "number") checkArg(3, text, "string") checkArg(4, vert, "boolean", "nil") + vert = false if vert then local i = 1 local len = utf8.len(text) @@ -251,7 +253,7 @@ function textgpu.start() c = unsub(c, 1, 1) if #c == 0 then return true end local str = c:rep(W) - for i=1, h, 1 do + for i=1, H, 1 do set(x, y + i - 1, str, nil, nil, true) end return true