Refonte pour utiliser le systeme de GUI #112
3 changed files with 5 additions and 5 deletions
|
@ -1,11 +1,11 @@
|
||||||
local Rect = require "birb.objects.2D.rect"
|
local Rect = require "birb.classes.2D.rect"
|
||||||
local GuiElement = Rect:extend()
|
local GuiElement = Rect:extend()
|
||||||
|
|
||||||
function GuiElement:new(name, x, y, w, h)
|
function GuiElement:new(name, x, y, w, h)
|
||||||
GuiElement.super.new(self, x, y, w, h)
|
GuiElement.super.new(self, x, y, w, h)
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
self.isVisible = false
|
self.isVisible = true
|
||||||
self.screen = nil
|
self.screen = nil
|
||||||
|
|
||||||
self.depth = 0
|
self.depth = 0
|
||||||
|
@ -14,7 +14,7 @@ function GuiElement:new(name, x, y, w, h)
|
||||||
end
|
end
|
||||||
|
|
||||||
function GuiElement:getGui()
|
function GuiElement:getGui()
|
||||||
local scene = core.scenemanager.currentScene
|
local scene = core.scenemanager.nextScene or core.scenemanager.currentScene
|
||||||
return scene.gui
|
return scene.gui
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ end
|
||||||
|
|
||||||
function ElementList:getVisibleElement(topLayer)
|
function ElementList:getVisibleElement(topLayer)
|
||||||
local visibleList = {}
|
local visibleList = {}
|
||||||
for _, element in ipairs(self.elements) do
|
for _, element in pairs(self.elements) do
|
||||||
if (element ~= nil) then
|
if (element ~= nil) then
|
||||||
if (element:getVisibility() and ((element.depth) < 0 == topLayer)) then
|
if (element:getVisibility() and ((element.depth) < 0 == topLayer)) then
|
||||||
table.insert(visibleList, element)
|
table.insert(visibleList, element)
|
||||||
|
|
|
@ -151,9 +151,9 @@ end
|
||||||
function Scene:drawScene()
|
function Scene:drawScene()
|
||||||
self:drawStart()
|
self:drawStart()
|
||||||
self:drawWorld()
|
self:drawWorld()
|
||||||
|
self.gui:drawBottom()
|
||||||
self:draw()
|
self:draw()
|
||||||
self:drawMenus()
|
self:drawMenus()
|
||||||
self.gui:drawBottom()
|
|
||||||
self:drawDialog()
|
self:drawDialog()
|
||||||
self:drawEnd()
|
self:drawEnd()
|
||||||
core.screen:drawTransition()
|
core.screen:drawTransition()
|
||||||
|
|
Loading…
Reference in a new issue