/
alex_baut11
/
lua-container-game
Обзор
Документация
Войти
/
alex_baut11
/
lua-container-game
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
screen_manager.lua
54 строки
1 KB
AlexB
sm
29 дек 2025, 11:46
29 дек 2025, 11:46
d4f82fb
Код
Авторство
О чём код?
ScreenManager = {} ScreenManager.__index = ScreenManager function ScreenManager:new(screens) local obj = { current = nil, splash_screen_radius = 0, switching = false, screens = screens } setmetatable(obj, ScreenManager) return obj end function ScreenManager:update(dt) if self.current and self.current.update then self.current:update(dt) end end function ScreenManager:draw() if self.current and self.current.draw then self.current:draw() end if self.switching then love.graphics.setColor(1,1,1) love.graphics.circle("fill", 400, 300, self.splash_screen_radius) end end function ScreenManager:change_screen(name) -- if self.current and self.current.leave then -- self.current:leave() -- end self.switching = true flux.to(self, 0.7, { splash_screen_radius = 600 }) :ease("cubicout") :oncomplete(function() self.current = self.screens[name]:new(self) if self.current.enter then self.current:enter() end flux.to(self, 0.4, { splash_screen_radius = 0.1}) :ease("cubicin") :oncomplete(function() self.switching = false end) end) end return ScreenManager