Skip to content

Commit

Permalink
Added examples menu
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl committed Jul 26, 2022
1 parent 0750bb7 commit ac408c6
Show file tree
Hide file tree
Showing 11 changed files with 1,357 additions and 1 deletion.
178 changes: 178 additions & 0 deletions example/controller.collection
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
name: "controller"
scale_along_z: 0
embedded_instances {
id: "go"
data: "components {\n"
" id: \"controller\"\n"
" component: \"/example/controller.script\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
"components {\n"
" id: \"back\"\n"
" component: \"/example/controller.gui\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"menu\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/example/menu.collection\\\"\\n"
"exclude: false\\n"
"\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"dragtoscroll\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/example/dragtoscroll/dragtoscroll.collection\\\"\\n"
"exclude: false\\n"
"\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"multicamera\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/example/multicamera/multicamera.collection\\\"\\n"
"exclude: false\\n"
"\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"bounds\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/example/bounds/bounds.collection\\\"\\n"
"exclude: false\\n"
"\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"basics\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/example/basics/basics.collection\\\"\\n"
"exclude: false\\n"
"\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"allfeatures\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/example/allfeatures/allfeatures.collection\\\"\\n"
"exclude: false\\n"
"\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"zoom\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/example/zoom/zoom.collection\\\"\\n"
"exclude: false\\n"
"\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
133 changes: 133 additions & 0 deletions example/controller.gui
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
script: "/example/controller.gui_script"
fonts {
name: "example"
font: "/example/shared/fonts/example.font"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 117.0
y: 672.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 100.0
y: 50.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: ""
id: "backbutton"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 100.0
y: 50.0
z: 0.0
w: 1.0
}
color {
x: 0.2
y: 0.2
z: 0.2
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "BACK"
font: "example"
id: "backtext"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "backbutton"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 1.0
shadow_alpha: 1.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512
19 changes: 19 additions & 0 deletions example/controller.gui_script
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
local gooey = require "gooey.gooey"

function init(self)
gooey.acquire_input()
end

function on_input(self, action_id, action)
local group = gooey.group("controller", function()
gooey.button("backbutton", action_id, action, function()
msg.post("controller:/go", "show" , { id = "menu" })
end)
end)
return group.consumed
end

function on_reload(self)
-- Add input-handling code here
-- Remove this function if not needed
end
24 changes: 24 additions & 0 deletions example/controller.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
local function show(self, proxy)
if self.current_proxy then
msg.post(self.current_proxy, "unload")
end
msg.post(proxy, "async_load")
end

function init(self)
msg.post(".", "acquire_input_focus")
msg.post("#", "show", { id = "menu" })
msg.post("@render:", "clear_color", { color = vmath.vector4(0.15, 0.15, 0.15, 1.0) })
end

function on_message(self, message_id, message, sender)
if message_id == hash("proxy_loaded") then
self.current_proxy = sender
msg.post(sender, "enable")
elseif message_id == hash("show") then
local id = message.id
show(self, "#" .. id)
else
print(message_id)
end
end
37 changes: 37 additions & 0 deletions example/menu.collection
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "menu"
scale_along_z: 0
embedded_instances {
id: "go"
data: "components {\n"
" id: \"menu\"\n"
" component: \"/example/menu.gui\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
Loading

0 comments on commit ac408c6

Please sign in to comment.