-
Notifications
You must be signed in to change notification settings - Fork 408
Expand file tree
/
Copy pathmain.lua
More file actions
79 lines (67 loc) · 1.9 KB
/
main.lua
File metadata and controls
79 lines (67 loc) · 1.9 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
local ltask = require "ltask"
local function start(config)
local function spawn_window()
local ServiceWindow = ltask.spawn_service {
unique = true,
name = "ant.window|window",
args = { config },
worker_id = 0,
}
ltask.call(ServiceWindow, "wait")
end
local function spawn_bgfx()
ltask.spawn_service {
unique = true,
name = "ant.hwi|bgfx",
worker_id = 1,
}
end
local function spawn_rmlui()
ltask.uniqueservice "ant.rmlui|rmlui"
end
local function spawn_resource()
ltask.uniqueservice "ant.resource_manager|resource"
end
for _, resp in ltask.parallel {
{ spawn_window },
{ spawn_bgfx },
{ spawn_rmlui },
{ spawn_resource },
} do
if resp.error then
resp:rethrow()
end
end
end
local function newproxy(t, k)
local ServiceWindow = ltask.queryservice "ant.window|window"
local function close()
ltask.send(ServiceWindow, "close")
end
local function reboot(initargs)
ltask.send(ServiceWindow, "reboot", initargs)
end
local function set_cursor(cursor)
ltask.call(ServiceWindow, "set_cursor", cursor)
end
local function show_cursor(show)
ltask.call(ServiceWindow, "show_cursor", show)
end
local function set_title(title)
ltask.call(ServiceWindow, "set_title", title)
end
local function set_fullscreen(fullscreen)
ltask.call(ServiceWindow, "set_fullscreen", fullscreen)
end
t.close = close
t.reboot = reboot
t.set_cursor = set_cursor
t.show_cursor = show_cursor
t.set_title = set_title
t.set_fullscreen = set_fullscreen
function t.get_cmd()
return ltask.call(ServiceWindow, "get_cmd")
end
return t[k]
end
return setmetatable({ start = start }, { __index = newproxy })