Refonte pour utiliser le systeme de GUI #112

Merged
kazhnuz merged 102 commits from feat/gui into master 2022-01-06 19:15:16 +01:00
2 changed files with 25 additions and 0 deletions
Showing only changes of commit dd0fcf2547 - Show all commits

View file

@ -28,6 +28,7 @@ local ScreenList = require "birb.modules.gui.mixins.screens"
Gui:implement(ScreenList)
Gui:implement(ElementList)
local TransformDataStruct = require "birb.structures.tween"
function Gui:new(scene)
self.scene = scene
@ -50,6 +51,25 @@ end
-- TWEEN FUNCTIONS
-- Handle tweening
function Gui:transform(data)
for _, rawTransform in ipairs(data) do
self:transformOne(rawTransform)
end
end
function Gui:transformOne(rawTransform)
local struct = TransformDataStruct[rawTransform[2]]
assert(struct ~= nil, "Structure " .. rawTransform[1] .. " doesn't exists ")
local transform = utils.table.parse(rawTransform, struct, 0)
if transform.type == "tween" then
self:newTween(transform.name, transform.start, transform.duration, transform.target, transform.easing)
elseif transform.type == "movement" then
self:newMovement(transform.name, transform.start, transform.duration, transform.x, transform.y, transform.easing)
elseif transform.type == "switch" then
self:newSwitch(transform.name, transform.start, transform.bools)
end
end
function Gui:newTween(element, start, duration, target, easing)
self.elements[element]:newTween(start, duration, target, easing)
end

View file

@ -0,0 +1,5 @@
return {
tween = {"name", "type", "start", "duration", "target", "easing"},
movement = {"name", "type", "start", "duration", "x", "y", "easing"},
switch = {"name", "type", "start", "bools"},
}