-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui.lua
More file actions
44 lines (38 loc) · 889 Bytes
/
gui.lua
File metadata and controls
44 lines (38 loc) · 889 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
gui = {}
guiObj = {
type = 'class',
dim = {
x = 0,
y = 0,
w = 0,
h = 0
},
structural = false
}
-- Gui object main class
function guiObj:new(o)
o = o or {}
setmetatable(o,self)
self.__index = self
return o
end
function guiObj:draw() end
function guiObj:update() end
function guiObj:mousePressed() end
function drawGui()
for k,v in pairs(gui) do
if v.type == not 'cursor' then
v:draw()
elseif v.type == 'cursor' and v.id == currentCur then
v:draw()
end
end
end
-- obj sublcasses
guiStructure = guiObj:new()
function guiStructure:draw()
local r,g,b,a = love.graphics.getColor()
love.graphics.rectangle('fill', self.dim.x, self.dim.y, self.dim.w, self.dim.h)
love.graphics.setColor(r, g, b, a)
end
-- instances