-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoptions.lua
More file actions
52 lines (44 loc) · 1.11 KB
/
Copy pathoptions.lua
File metadata and controls
52 lines (44 loc) · 1.11 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
-- Interface
#include "variable.lua"
#include "assets/interface/window.lua"
inMenu = true
local init = function()
for name, module in pairs(modules) do
if module.init then
module.init()
end
end
end
local draws = 0
local draw = function()
UiImage("MOD/assets/image/background/options.png")
UiPush()
DrawInterface()
UiPop()
draws = draws + 1
end
local pressed = function(key)
if key == "esc" then
SetString("savegame.mod.options", util.serialize(options))
end
for name, module in pairs(modules) do
if module.pressed then
UiPush()
module.pressed(key)
UiPop()
end
end
end
local released = function(key)
for name, module in pairs(modules) do
if module.released then
UiPush()
module.released(key)
UiPop()
end
end
end
hook.add("base.init", "performance.init", init)
hook.add("base.draw", "performance.draw", draw)
hook.add("api.key.pressed", "performance.key.pressed", pressed)
hook.add("api.key.released", "performance.key.released", released)