- Created Plugin loading system

- Added lazy loading system for elements (optional feature)
- Improved rendering performance
- Added ID system which is separated from Eement Names
- Added Focussystem for container
- Improved container performance by only rendering and handling events from visible childrens instead of all
- Added label and input
- Added animation and xml
This commit is contained in:
Robert Jelic
2025-02-13 10:51:12 +01:00
parent bca8889fbd
commit 6dfa554523
23 changed files with 1833 additions and 494 deletions

View File

@@ -1,4 +1,5 @@
local VisualElement = require("elements/VisualElement")
local elementManager = require("elementManager")
local VisualElement = elementManager.getElement("VisualElement")
local getCenteredPosition = require("libraries/utils").getCenteredPosition
---@class Button : VisualElement
@@ -6,23 +7,25 @@ local Button = setmetatable({}, VisualElement)
Button.__index = Button
---@property text string Button Button text
Button.defineProperty(Button, "text", {default = "Button", type = "string"})
Button.defineProperty(Button, "text", {default = "Button", type = "string", canTriggerRender = true})
---@event mouse_click The event that is triggered when the button is clicked
Button.listenTo(Button, "mouse_click")
---@diagnostic disable-next-line: duplicate-set-field
function Button.new(id, basalt)
function Button.new(props, basalt)
local self = setmetatable({}, Button):__init()
self:init(id, basalt)
self.set("type", "Button")
self:init(props, basalt)
self.set("width", 10)
self.set("height", 3)
self.set("z", 5)
return self
end
---@diagnostic disable-next-line: duplicate-set-field
function Button:init(props, basalt)
VisualElement.init(self, props, basalt)
self.set("type", "Button")
end
function Button:render()
VisualElement.render(self)
local text = self.get("text")