mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-30 17:17:55 +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:
10
patchwork.md
10
patchwork.md
@@ -325,3 +325,13 @@ d2a1a00dc43e5b65f6b64111ce76dd3db16c919f
|
|||||||
Clear gets an option to reset the palette (#582)
|
Clear gets an option to reset the palette (#582)
|
||||||
|
|
||||||
Fixes #555.
|
Fixes #555.
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
aab0cd34cd64fdf837ff1c3b91a957a25c2cf7f9
|
||||||
|
|
||||||
|
Use term.blit on original paint render
|
||||||
|
|
||||||
|
This makes it super speedy, meaning an initial refresh doesn't take ages
|
||||||
|
to load.
|
||||||
|
```
|
||||||
|
@@ -233,14 +233,31 @@ local function drawCanvasPixel(x, y)
|
|||||||
end
|
end
|
||||||
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
|
Converts each colour in a single line of the canvas and draws it
|
||||||
returns: nil
|
returns: nil
|
||||||
]]
|
]]
|
||||||
|
local text, fg, bg = "", "", ""
|
||||||
local function drawCanvasLine(y)
|
local function drawCanvasLine(y)
|
||||||
for x = 1, w - 2 do
|
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
|
end
|
||||||
|
term.setCursorPos(1, y)
|
||||||
|
term.blit(text, fg, bg)
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
|
Reference in New Issue
Block a user