Skip to content

Commit ac408c6

Browse files
committed
Added examples menu
1 parent 0750bb7 commit ac408c6

11 files changed

+1357
-1
lines changed

example/controller.collection

+178
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
name: "controller"
2+
scale_along_z: 0
3+
embedded_instances {
4+
id: "go"
5+
data: "components {\n"
6+
" id: \"controller\"\n"
7+
" component: \"/example/controller.script\"\n"
8+
" position {\n"
9+
" x: 0.0\n"
10+
" y: 0.0\n"
11+
" z: 0.0\n"
12+
" }\n"
13+
" rotation {\n"
14+
" x: 0.0\n"
15+
" y: 0.0\n"
16+
" z: 0.0\n"
17+
" w: 1.0\n"
18+
" }\n"
19+
"}\n"
20+
"components {\n"
21+
" id: \"back\"\n"
22+
" component: \"/example/controller.gui\"\n"
23+
" position {\n"
24+
" x: 0.0\n"
25+
" y: 0.0\n"
26+
" z: 0.0\n"
27+
" }\n"
28+
" rotation {\n"
29+
" x: 0.0\n"
30+
" y: 0.0\n"
31+
" z: 0.0\n"
32+
" w: 1.0\n"
33+
" }\n"
34+
"}\n"
35+
"embedded_components {\n"
36+
" id: \"menu\"\n"
37+
" type: \"collectionproxy\"\n"
38+
" data: \"collection: \\\"/example/menu.collection\\\"\\n"
39+
"exclude: false\\n"
40+
"\"\n"
41+
" position {\n"
42+
" x: 0.0\n"
43+
" y: 0.0\n"
44+
" z: 0.0\n"
45+
" }\n"
46+
" rotation {\n"
47+
" x: 0.0\n"
48+
" y: 0.0\n"
49+
" z: 0.0\n"
50+
" w: 1.0\n"
51+
" }\n"
52+
"}\n"
53+
"embedded_components {\n"
54+
" id: \"dragtoscroll\"\n"
55+
" type: \"collectionproxy\"\n"
56+
" data: \"collection: \\\"/example/dragtoscroll/dragtoscroll.collection\\\"\\n"
57+
"exclude: false\\n"
58+
"\"\n"
59+
" position {\n"
60+
" x: 0.0\n"
61+
" y: 0.0\n"
62+
" z: 0.0\n"
63+
" }\n"
64+
" rotation {\n"
65+
" x: 0.0\n"
66+
" y: 0.0\n"
67+
" z: 0.0\n"
68+
" w: 1.0\n"
69+
" }\n"
70+
"}\n"
71+
"embedded_components {\n"
72+
" id: \"multicamera\"\n"
73+
" type: \"collectionproxy\"\n"
74+
" data: \"collection: \\\"/example/multicamera/multicamera.collection\\\"\\n"
75+
"exclude: false\\n"
76+
"\"\n"
77+
" position {\n"
78+
" x: 0.0\n"
79+
" y: 0.0\n"
80+
" z: 0.0\n"
81+
" }\n"
82+
" rotation {\n"
83+
" x: 0.0\n"
84+
" y: 0.0\n"
85+
" z: 0.0\n"
86+
" w: 1.0\n"
87+
" }\n"
88+
"}\n"
89+
"embedded_components {\n"
90+
" id: \"bounds\"\n"
91+
" type: \"collectionproxy\"\n"
92+
" data: \"collection: \\\"/example/bounds/bounds.collection\\\"\\n"
93+
"exclude: false\\n"
94+
"\"\n"
95+
" position {\n"
96+
" x: 0.0\n"
97+
" y: 0.0\n"
98+
" z: 0.0\n"
99+
" }\n"
100+
" rotation {\n"
101+
" x: 0.0\n"
102+
" y: 0.0\n"
103+
" z: 0.0\n"
104+
" w: 1.0\n"
105+
" }\n"
106+
"}\n"
107+
"embedded_components {\n"
108+
" id: \"basics\"\n"
109+
" type: \"collectionproxy\"\n"
110+
" data: \"collection: \\\"/example/basics/basics.collection\\\"\\n"
111+
"exclude: false\\n"
112+
"\"\n"
113+
" position {\n"
114+
" x: 0.0\n"
115+
" y: 0.0\n"
116+
" z: 0.0\n"
117+
" }\n"
118+
" rotation {\n"
119+
" x: 0.0\n"
120+
" y: 0.0\n"
121+
" z: 0.0\n"
122+
" w: 1.0\n"
123+
" }\n"
124+
"}\n"
125+
"embedded_components {\n"
126+
" id: \"allfeatures\"\n"
127+
" type: \"collectionproxy\"\n"
128+
" data: \"collection: \\\"/example/allfeatures/allfeatures.collection\\\"\\n"
129+
"exclude: false\\n"
130+
"\"\n"
131+
" position {\n"
132+
" x: 0.0\n"
133+
" y: 0.0\n"
134+
" z: 0.0\n"
135+
" }\n"
136+
" rotation {\n"
137+
" x: 0.0\n"
138+
" y: 0.0\n"
139+
" z: 0.0\n"
140+
" w: 1.0\n"
141+
" }\n"
142+
"}\n"
143+
"embedded_components {\n"
144+
" id: \"zoom\"\n"
145+
" type: \"collectionproxy\"\n"
146+
" data: \"collection: \\\"/example/zoom/zoom.collection\\\"\\n"
147+
"exclude: false\\n"
148+
"\"\n"
149+
" position {\n"
150+
" x: 0.0\n"
151+
" y: 0.0\n"
152+
" z: 0.0\n"
153+
" }\n"
154+
" rotation {\n"
155+
" x: 0.0\n"
156+
" y: 0.0\n"
157+
" z: 0.0\n"
158+
" w: 1.0\n"
159+
" }\n"
160+
"}\n"
161+
""
162+
position {
163+
x: 0.0
164+
y: 0.0
165+
z: 0.0
166+
}
167+
rotation {
168+
x: 0.0
169+
y: 0.0
170+
z: 0.0
171+
w: 1.0
172+
}
173+
scale3 {
174+
x: 1.0
175+
y: 1.0
176+
z: 1.0
177+
}
178+
}

example/controller.gui

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
script: "/example/controller.gui_script"
2+
fonts {
3+
name: "example"
4+
font: "/example/shared/fonts/example.font"
5+
}
6+
background_color {
7+
x: 0.0
8+
y: 0.0
9+
z: 0.0
10+
w: 0.0
11+
}
12+
nodes {
13+
position {
14+
x: 117.0
15+
y: 672.0
16+
z: 0.0
17+
w: 1.0
18+
}
19+
rotation {
20+
x: 0.0
21+
y: 0.0
22+
z: 0.0
23+
w: 1.0
24+
}
25+
scale {
26+
x: 1.0
27+
y: 1.0
28+
z: 1.0
29+
w: 1.0
30+
}
31+
size {
32+
x: 100.0
33+
y: 50.0
34+
z: 0.0
35+
w: 1.0
36+
}
37+
color {
38+
x: 1.0
39+
y: 1.0
40+
z: 1.0
41+
w: 1.0
42+
}
43+
type: TYPE_BOX
44+
blend_mode: BLEND_MODE_ALPHA
45+
texture: ""
46+
id: "backbutton"
47+
xanchor: XANCHOR_NONE
48+
yanchor: YANCHOR_NONE
49+
pivot: PIVOT_CENTER
50+
adjust_mode: ADJUST_MODE_FIT
51+
layer: ""
52+
inherit_alpha: true
53+
slice9 {
54+
x: 0.0
55+
y: 0.0
56+
z: 0.0
57+
w: 0.0
58+
}
59+
clipping_mode: CLIPPING_MODE_NONE
60+
clipping_visible: true
61+
clipping_inverted: false
62+
alpha: 1.0
63+
template_node_child: false
64+
size_mode: SIZE_MODE_MANUAL
65+
custom_type: 0
66+
}
67+
nodes {
68+
position {
69+
x: 0.0
70+
y: 0.0
71+
z: 0.0
72+
w: 1.0
73+
}
74+
rotation {
75+
x: 0.0
76+
y: 0.0
77+
z: 0.0
78+
w: 1.0
79+
}
80+
scale {
81+
x: 1.0
82+
y: 1.0
83+
z: 1.0
84+
w: 1.0
85+
}
86+
size {
87+
x: 100.0
88+
y: 50.0
89+
z: 0.0
90+
w: 1.0
91+
}
92+
color {
93+
x: 0.2
94+
y: 0.2
95+
z: 0.2
96+
w: 1.0
97+
}
98+
type: TYPE_TEXT
99+
blend_mode: BLEND_MODE_ALPHA
100+
text: "BACK"
101+
font: "example"
102+
id: "backtext"
103+
xanchor: XANCHOR_NONE
104+
yanchor: YANCHOR_NONE
105+
pivot: PIVOT_CENTER
106+
outline {
107+
x: 1.0
108+
y: 1.0
109+
z: 1.0
110+
w: 1.0
111+
}
112+
shadow {
113+
x: 1.0
114+
y: 1.0
115+
z: 1.0
116+
w: 1.0
117+
}
118+
adjust_mode: ADJUST_MODE_FIT
119+
line_break: false
120+
parent: "backbutton"
121+
layer: ""
122+
inherit_alpha: true
123+
alpha: 1.0
124+
outline_alpha: 1.0
125+
shadow_alpha: 1.0
126+
template_node_child: false
127+
text_leading: 1.0
128+
text_tracking: 0.0
129+
custom_type: 0
130+
}
131+
material: "/builtins/materials/gui.material"
132+
adjust_reference: ADJUST_REFERENCE_PARENT
133+
max_nodes: 512

example/controller.gui_script

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
local gooey = require "gooey.gooey"
2+
3+
function init(self)
4+
gooey.acquire_input()
5+
end
6+
7+
function on_input(self, action_id, action)
8+
local group = gooey.group("controller", function()
9+
gooey.button("backbutton", action_id, action, function()
10+
msg.post("controller:/go", "show" , { id = "menu" })
11+
end)
12+
end)
13+
return group.consumed
14+
end
15+
16+
function on_reload(self)
17+
-- Add input-handling code here
18+
-- Remove this function if not needed
19+
end

example/controller.script

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
local function show(self, proxy)
2+
if self.current_proxy then
3+
msg.post(self.current_proxy, "unload")
4+
end
5+
msg.post(proxy, "async_load")
6+
end
7+
8+
function init(self)
9+
msg.post(".", "acquire_input_focus")
10+
msg.post("#", "show", { id = "menu" })
11+
msg.post("@render:", "clear_color", { color = vmath.vector4(0.15, 0.15, 0.15, 1.0) })
12+
end
13+
14+
function on_message(self, message_id, message, sender)
15+
if message_id == hash("proxy_loaded") then
16+
self.current_proxy = sender
17+
msg.post(sender, "enable")
18+
elseif message_id == hash("show") then
19+
local id = message.id
20+
show(self, "#" .. id)
21+
else
22+
print(message_id)
23+
end
24+
end

example/menu.collection

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: "menu"
2+
scale_along_z: 0
3+
embedded_instances {
4+
id: "go"
5+
data: "components {\n"
6+
" id: \"menu\"\n"
7+
" component: \"/example/menu.gui\"\n"
8+
" position {\n"
9+
" x: 0.0\n"
10+
" y: 0.0\n"
11+
" z: 0.0\n"
12+
" }\n"
13+
" rotation {\n"
14+
" x: 0.0\n"
15+
" y: 0.0\n"
16+
" z: 0.0\n"
17+
" w: 1.0\n"
18+
" }\n"
19+
"}\n"
20+
""
21+
position {
22+
x: 0.0
23+
y: 0.0
24+
z: 0.0
25+
}
26+
rotation {
27+
x: 0.0
28+
y: 0.0
29+
z: 0.0
30+
w: 1.0
31+
}
32+
scale3 {
33+
x: 1.0
34+
y: 1.0
35+
z: 1.0
36+
}
37+
}

0 commit comments

Comments
 (0)