mirror of
https://github.com/LDDestroier/CC/
synced 2025-01-08 08:20:27 +00:00
Fixed block character selector, added byte indicator
This commit is contained in:
parent
d575a3b660
commit
ab57b5b36a
17
pain.lua
17
pain.lua
@ -1901,10 +1901,12 @@ local boxCharSelector = function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
local rend = function()
|
local rend = function()
|
||||||
term.setCursorPos(1,scr_y)
|
term.setCursorPos(scr_x - 3, scr_y)
|
||||||
term.setBackgroundColor(colors.lightGray)
|
term.setBackgroundColor(colors.lightGray)
|
||||||
term.setTextColor(colors.black)
|
term.setTextColor(colors.gray)
|
||||||
term.clearLine()
|
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.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-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")
|
term.setCursorPos(1,scr_y-2) co(boxchar.left) write("A") co(boxchar.right) write("S")
|
||||||
@ -1927,7 +1929,7 @@ local boxCharSelector = function()
|
|||||||
end
|
end
|
||||||
elseif evt[1] == "mouse_click" or evt[1] == "mouse_drag" then
|
elseif evt[1] == "mouse_click" or evt[1] == "mouse_drag" then
|
||||||
local button, mx, my = evt[2], evt[3], evt[4]
|
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 mx == 1 then
|
||||||
if my == scr_y - 3 then boxchar.topLeft = not boxchar.topLeft end
|
if my == scr_y - 3 then boxchar.topLeft = not boxchar.topLeft end
|
||||||
if my == scr_y - 2 then boxchar.left = not boxchar.left 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
|
for x = 1, 16 do
|
||||||
chars[y] = chars[y] or {}
|
chars[y] = chars[y] or {}
|
||||||
chars[y][x] = string.char(buff)
|
chars[y][x] = string.char(buff)
|
||||||
buff = buff + 1
|
buff = buff + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local sy = scr_y - (#chars + 1)
|
local sy = scr_y - (#chars + 1)
|
||||||
@ -1988,6 +1990,9 @@ local specialCharSelector = function()
|
|||||||
term.write("Press CTRL or 'N' when ready.")
|
term.write("Press CTRL or 'N' when ready.")
|
||||||
|
|
||||||
while true do
|
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()
|
evt, butt, x, y = os.pullEvent()
|
||||||
if (evt == "mouse_click" or evt == "mouse_drag") then
|
if (evt == "mouse_click" or evt == "mouse_drag") then
|
||||||
if chars[y-sy] then
|
if chars[y-sy] then
|
||||||
@ -1996,10 +2001,10 @@ local specialCharSelector = function()
|
|||||||
char = chars[y-sy][x]
|
char = chars[y-sy][x]
|
||||||
render()
|
render()
|
||||||
end
|
end
|
||||||
else
|
elseif evt == "mouse_click" then
|
||||||
return char
|
return char
|
||||||
end
|
end
|
||||||
else
|
elseif evt == "mouse_click" then
|
||||||
return char
|
return char
|
||||||
end
|
end
|
||||||
elseif evt == "key" then
|
elseif evt == "key" then
|
||||||
|
Loading…
Reference in New Issue
Block a user