mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-13 03:30:29 +00:00
Use term.blit on original paint render
This makes it super speedy, meaning an initial refresh doesn't take ages to load.
This commit is contained in:
parent
d2a1a00dc4
commit
aab0cd34cd
@ -233,14 +233,32 @@ local function drawCanvasPixel(x, y)
|
||||
end
|
||||
end
|
||||
|
||||
local color_hex_lookup = {}
|
||||
for i = 0, 15 do
|
||||
color_hex_lookup[2 ^ i] = string.format("%x", i)
|
||||
end
|
||||
|
||||
--[[
|
||||
Converts each colour in a single line of the canvas and draws it
|
||||
returns: nil
|
||||
]]
|
||||
local function drawCanvasLine(y)
|
||||
local text, fg, bg = "", "", ""
|
||||
for x = 1, w - 2 do
|
||||
drawCanvasPixel(x, y)
|
||||
local pixel = getCanvasPixel(x, y)
|
||||
if pixel then
|
||||
text = text .. " "
|
||||
fg = fg .. "0"
|
||||
bg = bg .. color_hex_lookup[pixel or canvasColour]
|
||||
else
|
||||
text = text .. "\127"
|
||||
fg = fg .. color_hex_lookup[canvasColour]
|
||||
bg = bg .. color_hex_lookup[colours.grey]
|
||||
end
|
||||
end
|
||||
|
||||
term.setCursorPos(1, y)
|
||||
term.blit(text, fg, bg)
|
||||
end
|
||||
|
||||
--[[
|
||||
|
Loading…
Reference in New Issue
Block a user