mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-06-10 02:24:12 +00:00
Make palettes work properly with the window API
This commit is contained in:
parent
3de674dfb1
commit
bfa5f6ec9c
@ -94,12 +94,6 @@ function create( parent, nX, nY, nWidth, nHeight, bStartVisible )
|
|||||||
parent.setTextColor( nTextColor )
|
parent.setTextColor( nTextColor )
|
||||||
end
|
end
|
||||||
|
|
||||||
local function updatePalette()
|
|
||||||
for k,v in pairs(tPalette) do
|
|
||||||
parent.setColour( k, table.unpack( v ) )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function redrawLine( n )
|
local function redrawLine( n )
|
||||||
local tLine = tLines[ n ]
|
local tLine = tLines[ n ]
|
||||||
parent.setCursorPos( nX, nY + n - 1 )
|
parent.setCursorPos( nX, nY + n - 1 )
|
||||||
@ -112,6 +106,12 @@ function create( parent, nX, nY, nWidth, nHeight, bStartVisible )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function updatePalette()
|
||||||
|
for k,v in pairs(tPalette) do
|
||||||
|
parent.setColour( k, table.unpack( v ) )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function internalBlit( sText, sTextColor, sBackgroundColor )
|
local function internalBlit( sText, sTextColor, sBackgroundColor )
|
||||||
local nStart = nCursorX
|
local nStart = nCursorX
|
||||||
local nEnd = nStart + #sText - 1
|
local nEnd = nStart + #sText - 1
|
||||||
@ -293,6 +293,10 @@ function create( parent, nX, nY, nWidth, nHeight, bStartVisible )
|
|||||||
tCol[1] = r
|
tCol[1] = r
|
||||||
tCol[2] = g
|
tCol[2] = g
|
||||||
tCol[3] = b
|
tCol[3] = b
|
||||||
|
|
||||||
|
if bVisible then
|
||||||
|
return updatePalette()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
window.setColor = window.setColour
|
window.setColor = window.setColour
|
||||||
@ -380,10 +384,10 @@ function create( parent, nX, nY, nWidth, nHeight, bStartVisible )
|
|||||||
function window.redraw()
|
function window.redraw()
|
||||||
if bVisible then
|
if bVisible then
|
||||||
redraw()
|
redraw()
|
||||||
|
updatePalette()
|
||||||
updateCursorBlink()
|
updateCursorBlink()
|
||||||
updateCursorColor()
|
updateCursorColor()
|
||||||
updateCursorPos()
|
updateCursorPos()
|
||||||
updatePalette()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user