mirror of
https://github.com/LDDestroier/CC/
synced 2024-11-08 19:09:58 +00:00
Update windont.lua
This commit is contained in:
parent
ec091d2031
commit
0762fc95e1
@ -55,6 +55,7 @@ lval.to_blit[0], lval.to_colors["-"] = "-", 0
|
|||||||
|
|
||||||
local windont = {
|
local windont = {
|
||||||
doClearScreen = false, -- if true, will clear the screen during render
|
doClearScreen = false, -- if true, will clear the screen during render
|
||||||
|
ignoreUnchangedLines = true, -- if true, the render function will check each line it renders against the last framebuffer and ignore it if they are the same
|
||||||
useSetVisible = false, -- if true, sets the base terminal's visibility to false before rendering
|
useSetVisible = false, -- if true, sets the base terminal's visibility to false before rendering
|
||||||
default = {
|
default = {
|
||||||
baseTerm = term.current(), -- default base terminal for all windows
|
baseTerm = term.current(), -- default base terminal for all windows
|
||||||
@ -76,6 +77,13 @@ local windont = {
|
|||||||
-- should not draw over any terminal space that isn't occupied by a window
|
-- should not draw over any terminal space that isn't occupied by a window
|
||||||
|
|
||||||
windont.render = function(options, ...)
|
windont.render = function(options, ...)
|
||||||
|
-- potential options:
|
||||||
|
-- number: onlyX1
|
||||||
|
-- number: onlyX2
|
||||||
|
-- number: onlyY
|
||||||
|
-- boolean: force (forces render / ignores optimiztaion that compares current framebuffer to old one)
|
||||||
|
-- terminal: baseTerm (forces to render onto this terminal instead of the window's base terminal)
|
||||||
|
|
||||||
local windows = {...}
|
local windows = {...}
|
||||||
options = options or {}
|
options = options or {}
|
||||||
local bT, scr_x, scr_y
|
local bT, scr_x, scr_y
|
||||||
@ -110,9 +118,16 @@ windont.render = function(options, ...)
|
|||||||
local oriChar, oriText, oriBack
|
local oriChar, oriText, oriBack
|
||||||
|
|
||||||
local baseTerms = {}
|
local baseTerms = {}
|
||||||
for i = 1, #windows do
|
if type(options.baseTerm) == "table" then
|
||||||
baseTerms[windows[i].meta.baseTerm] = baseTerms[windows[i].meta.baseTerm] or {}
|
for i = 1, #windows do
|
||||||
baseTerms[windows[i].meta.baseTerm][i] = true
|
baseTerms[options.baseTerm] = baseTerms[options.baseTerm] or {}
|
||||||
|
baseTerms[options.baseTerm][i] = true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for i = 1, #windows do
|
||||||
|
baseTerms[windows[i].meta.baseTerm] = baseTerms[windows[i].meta.baseTerm] or {}
|
||||||
|
baseTerms[windows[i].meta.baseTerm][i] = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for bT, bT_list in pairs(baseTerms) do
|
for bT, bT_list in pairs(baseTerms) do
|
||||||
@ -208,7 +223,7 @@ windont.render = function(options, ...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if (not lval.oldScreenBuffer[bT]) or (
|
if (not lval.oldScreenBuffer[bT]) or (not windont.ignoreUnchangedLines) or (options.force) or (
|
||||||
table_concat(screenBuffer[1][y]) ~= table_concat(lval.oldScreenBuffer[bT][1][y]) or
|
table_concat(screenBuffer[1][y]) ~= table_concat(lval.oldScreenBuffer[bT][1][y]) or
|
||||||
table_concat(screenBuffer[2][y]) ~= table_concat(lval.oldScreenBuffer[bT][2][y]) or
|
table_concat(screenBuffer[2][y]) ~= table_concat(lval.oldScreenBuffer[bT][2][y]) or
|
||||||
table_concat(screenBuffer[3][y]) ~= table_concat(lval.oldScreenBuffer[bT][3][y])
|
table_concat(screenBuffer[3][y]) ~= table_concat(lval.oldScreenBuffer[bT][3][y])
|
||||||
|
Loading…
Reference in New Issue
Block a user