-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathoverlay.lua
More file actions
55 lines (42 loc) · 1.01 KB
/
overlay.lua
File metadata and controls
55 lines (42 loc) · 1.01 KB
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
49
50
51
52
53
54
55
overlay = {}
overlays = {}
local curOverlay = false
local overlayInitData = {}
-- Overlay switcher helper
function overlay.switch(overlay, data)
-- Ignore call if we're already on the same overlay
if curOverlay == overlay then return end
curOverlay = overlay
overlayInitData = data or {}
if curOverlay and overlays[curOverlay].init ~= nil then
overlays[curOverlay].init(overlayInitData)
end
end
function overlay.isActive()
return curOverlay ~= false
end
function overlay.runBack()
if overlays[curOverlay].back ~= nil then
overlays[curOverlay].back()
end
end
function overlay.runUpdate(dt)
if curOverlay then
if overlays[curOverlay].update ~= nil then
overlays[curOverlay].update(dt)
end
if overlays[curOverlay].gui ~= nil then
overlays[curOverlay].gui:update()
end
end
end
function overlay.runDraw()
if curOverlay then
if overlays[curOverlay].draw ~= nil then
overlays[curOverlay].draw()
end
if overlays[curOverlay].gui ~= nil then
overlays[curOverlay].gui:draw()
end
end
end