mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-04-13 14:23:17 +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 )
|
||||
end
|
||||
|
||||
local function updatePalette()
|
||||
for k,v in pairs(tPalette) do
|
||||
parent.setColour( k, table.unpack( v ) )
|
||||
end
|
||||
end
|
||||
|
||||
local function redrawLine( n )
|
||||
local tLine = tLines[ n ]
|
||||
parent.setCursorPos( nX, nY + n - 1 )
|
||||
@ -112,6 +106,12 @@ function create( parent, nX, nY, nWidth, nHeight, bStartVisible )
|
||||
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 nStart = nCursorX
|
||||
local nEnd = nStart + #sText - 1
|
||||
@ -293,6 +293,10 @@ function create( parent, nX, nY, nWidth, nHeight, bStartVisible )
|
||||
tCol[1] = r
|
||||
tCol[2] = g
|
||||
tCol[3] = b
|
||||
|
||||
if bVisible then
|
||||
return updatePalette()
|
||||
end
|
||||
end
|
||||
|
||||
window.setColor = window.setColour
|
||||
@ -380,10 +384,10 @@ function create( parent, nX, nY, nWidth, nHeight, bStartVisible )
|
||||
function window.redraw()
|
||||
if bVisible then
|
||||
redraw()
|
||||
updatePalette()
|
||||
updateCursorBlink()
|
||||
updateCursorColor()
|
||||
updateCursorPos()
|
||||
updatePalette()
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user