-
Notifications
You must be signed in to change notification settings - Fork 0
/
gui.gui_script
49 lines (39 loc) · 1.2 KB
/
gui.gui_script
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
function init(self)
local width, height = window.get_size()
local screen = gui.new_box_node(vmath.vector3(), vmath.vector3())
gui.set_color(screen, vmath.vector3(1, 1, 1, 1))
yoga.new_node(screen)
yoga.set_width_height(screen, width, height)
yoga.set_align_items(screen, yoga.ALIGN_STRETCH)
--red
local header = gui.new_box_node(vmath.vector3(), vmath.vector3())
gui.set_color(header, vmath.vector3(1, 0, 0, 0.3))
yoga.new_node(header)
yoga.set_height(header, 100)
--green
local body = gui.new_box_node(vmath.vector3(), vmath.vector3())
gui.set_color(body, vmath.vector3(0, 1, 0, 0.3))
yoga.new_node(body)
yoga.set_grow(body, 1)
--blue
local footer = gui.new_box_node(vmath.vector3(), vmath.vector3())
gui.set_color(footer, vmath.vector3(0, 0, 1, 0.3))
yoga.new_node(footer)
yoga.set_min_height(footer, 50)
yoga.set_margin(footer, yoga.EDGE_TOP, 5)
yoga.set_parent(body, screen)
yoga.set_parent(header, body)
yoga.set_parent(footer, screen)
yoga.calculate_layout(screen)
yoga.update_node(screen)
end
function final(self)
end
function update(self, dt)
end
function on_message(self, message_id, message, sender)
end
function on_input(self, action_id, action)
end
function on_reload(self)
end