Make palettes work properly with the window API

This commit is contained in:
Lignum 2017-05-05 20:23:57 +02:00
parent 3de674dfb1
commit bfa5f6ec9c
No known key found for this signature in database
GPG Key ID: 0889206F5A8A700D
1 changed files with 11 additions and 7 deletions

View File

@ -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