This repository was archived by the owner on Mar 3, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomplexGui.lua
More file actions
43 lines (36 loc) · 1.35 KB
/
complexGui.lua
File metadata and controls
43 lines (36 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
local complexGui = {objectsDirectory = "complexObjects", objects = {}}
function complexGui:addObject(name)
complexGui.objects[name] = require(complexGui.objectsDirectory .. "/" .. name)
end
function complexGui:searchAndAddObjects()
local files = love.filesystem.getDirectoryItems(complexGui.objectsDirectory)
for fileNumber, fileName in ipairs(files) do
local fileNameWithoutExtension = string.gsub(fileName, ".lua", "")
complexGui:addObject(fileNameWithoutExtension)
end
end
function complexGui:makeComplex(object, objectName)
object.complex = objectName
object.type = objectName
object.updateChildrenPositionAndSize = function(this)
local children = this:GetChildren()
if not children then
return
end
for key, child in pairs(this:GetChildren()) do
if not (child.isResizeButton and child.dragging) then
child:updatePositionAndSizeRelativeToParent()
end
child:setProperFontSize(currentState.defaultFontFileName)
if child.complex then
child:updateChildrenPositionAndSize()
end
end
end
end
function complexGui:Create(objectName, args)
local object = complexGui.objects[objectName]:Create(args)
complexGui:makeComplex(object, objectName)
return object
end
return complexGui