-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui.lua
More file actions
48 lines (39 loc) · 757 Bytes
/
gui.lua
File metadata and controls
48 lines (39 loc) · 757 Bytes
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
44
45
46
47
48
local instance
local gui = {}
setmetatable(gui,gui)
function gui:__call()
if instance then return instance
else
local nt = {elements = {}}
setmetatable(nt,{__index = gui})
return nt
end
end
function gui:addElement(element)
table.insert(self.elements,element)
end
function gui:update()
for k,v in ipairs(self.elements) do
v:update()
end
end
function gui:draw(scaleX,scaleY)
for k,v in ipairs(self.elements) do
v:draw(scaleX,scaleY)
end
end
function gui:drawFrontLayer(scaleX,scaleY)
for k,v in ipairs (self.elements) do
if v.front then
v:draw(scaleX,scaleY)
end
end
end
function gui:drawBackLayer(scaleX,scaleY)
for k,v in ipairs(self.elements) do
if not v.front then
v:draw(scaleX,scaleY)
end
end
end
return gui