Fixed block character selector, added byte indicator

This commit is contained in:
LDDestroier 2019-10-08 03:38:48 -04:00 committed by GitHub
parent d575a3b660
commit ab57b5b36a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 10 deletions

View File

@ -1901,10 +1901,12 @@ local boxCharSelector = function()
end
end
local rend = function()
term.setCursorPos(1,scr_y)
term.setCursorPos(scr_x - 3, scr_y)
term.setBackgroundColor(colors.lightGray)
term.setTextColor(colors.black)
term.setTextColor(colors.gray)
term.clearLine()
term.write("\\" .. string.byte(getDrawingCharacter(boxchar.topLeft, boxchar.topRight, boxchar.left, boxchar.right, boxchar.bottomLeft, boxchar.bottomRight).char) .. " ")
term.setTextColor(colors.black)
term.write("Press CTRL or 'N' when ready.")
term.setCursorPos(1,scr_y-3) co(boxchar.topLeft) write("Q") co(boxchar.topRight) write("W")
term.setCursorPos(1,scr_y-2) co(boxchar.left) write("A") co(boxchar.right) write("S")
@ -1927,7 +1929,7 @@ local boxCharSelector = function()
end
elseif evt[1] == "mouse_click" or evt[1] == "mouse_drag" then
local button, mx, my = evt[2], evt[3], evt[4]
if my >= scr_y-2 then
if my >= scr_y-3 then
if mx == 1 then
if my == scr_y - 3 then boxchar.topLeft = not boxchar.topLeft end
if my == scr_y - 2 then boxchar.left = not boxchar.left end
@ -1961,7 +1963,7 @@ local specialCharSelector = function()
for x = 1, 16 do
chars[y] = chars[y] or {}
chars[y][x] = string.char(buff)
buff = buff + 1
buff = buff + 1
end
end
local sy = scr_y - (#chars + 1)
@ -1988,6 +1990,9 @@ local specialCharSelector = function()
term.write("Press CTRL or 'N' when ready.")
while true do
term.setCursorPos(scr_x - 3, scr_y)
term.setTextColor(colors.gray)
term.write("\\" .. string.byte(char) .. " ")
evt, butt, x, y = os.pullEvent()
if (evt == "mouse_click" or evt == "mouse_drag") then
if chars[y-sy] then
@ -1996,10 +2001,10 @@ local specialCharSelector = function()
char = chars[y-sy][x]
render()
end
else
elseif evt == "mouse_click" then
return char
end
else
elseif evt == "mouse_click" then
return char
end
elseif evt == "key" then