Canvas test

This commit is contained in:
Robert Jelic
2025-03-31 03:28:16 +02:00
parent 4f631b47cb
commit d27760adc2
7 changed files with 418 additions and 1 deletions

View File

@@ -168,6 +168,27 @@ function VisualElement:textBg(x, y, text, bg)
self.parent:textBg(x, y, text, bg)
end
function VisualElement:drawText(x, y, text)
local xElement, yElement = self:calculatePosition()
x = x + xElement - 1
y = y + yElement - 1
self.parent:drawText(x, y, text)
end
function VisualElement:drawFg(x, y, fg)
local xElement, yElement = self:calculatePosition()
x = x + xElement - 1
y = y + yElement - 1
self.parent:drawFg(x, y, fg)
end
function VisualElement:drawBg(x, y, bg)
local xElement, yElement = self:calculatePosition()
x = x + xElement - 1
y = y + yElement - 1
self.parent:drawBg(x, y, bg)
end
--- @shortDescription Draws text with both colors
--- @param x number The x position to draw
--- @param y number The y position to draw
@@ -440,4 +461,9 @@ function VisualElement:render()
self:multiBlit(1, 1, width, height, " ", tHex[self.get("foreground")], tHex[self.get("background")])
end
--- @shortDescription Post-rendering function for the element
--- @protected
function VisualElement:postRender()
end
return VisualElement