Skip to content

Commit

Permalink
Added the camera # label to the example gui.
Browse files Browse the repository at this point in the history
  • Loading branch information
astrochili committed Sep 23, 2023
1 parent 5a5a118 commit f3d936f
Show file tree
Hide file tree
Showing 3 changed files with 214 additions and 6 deletions.
208 changes: 202 additions & 6 deletions example/hint.gui
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
script: ""
script: "/example/hint.gui_script"
fonts {
name: "system_font"
font: "/builtins/fonts/system_font.font"
Expand Down Expand Up @@ -43,7 +43,7 @@ nodes {
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: ""
id: "box"
id: "hint_box"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
Expand All @@ -62,6 +62,10 @@ nodes {
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
enabled: true
visible: true
material: ""
}
nodes {
position {
Expand Down Expand Up @@ -97,12 +101,12 @@ nodes {
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: ""
id: "background"
id: "hint_background"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_SW
adjust_mode: ADJUST_MODE_FIT
parent: "box"
parent: "hint_box"
layer: ""
inherit_alpha: true
slice9 {
Expand All @@ -117,6 +121,10 @@ nodes {
alpha: 0.4
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
enabled: true
visible: true
material: ""
}
nodes {
position {
Expand Down Expand Up @@ -158,7 +166,7 @@ nodes {
"[H] - This Hint\n"
"[D] - Debug"
font: "system_font"
id: "text"
id: "hint_text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_SW
Expand All @@ -176,7 +184,7 @@ nodes {
}
adjust_mode: ADJUST_MODE_FIT
line_break: true
parent: "box"
parent: "hint_box"
layer: ""
inherit_alpha: false
alpha: 1.0
Expand All @@ -185,6 +193,194 @@ nodes {
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
enabled: true
visible: true
material: ""
}
nodes {
position {
x: 960.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: 0.7
y: 0.7
z: 0.7
w: 1.0
}
size {
x: 0.0
y: 0.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: "camera_box"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_STRETCH
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
enabled: true
visible: true
material: ""
}
nodes {
position {
x: -16.0
y: 16.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: 170.0
y: 70.0
z: 0.0
w: 1.0
}
color {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: ""
id: "camera_background"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_SE
adjust_mode: ADJUST_MODE_FIT
parent: "camera_box"
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: 0.4
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
enabled: true
visible: true
material: ""
}
nodes {
position {
x: -32.0
y: 32.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 2.0
y: 2.0
z: 2.0
w: 1.0
}
size {
x: 960.0
y: 0.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "CAMERA #"
font: "system_font"
id: "camera_text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_SE
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: true
parent: "camera_box"
layer: ""
inherit_alpha: false
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
enabled: true
visible: true
material: ""
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
Expand Down
9 changes: 9 additions & 0 deletions example/hint.gui_script
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function init(self)
self.camera_text = gui.get_node('camera_text')
end

function on_message(self, message_id, message, sender)
if message_id == hash 'camera_did_change' then
gui.set_text(self.camera_text, message.camera)
end
end
3 changes: 3 additions & 0 deletions example/scenario.script
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function init(self)

msg.post(self.urls.operator_2, hashes.activate)
msg.post(self.urls.operator_2, hashes.follow_sequence, self.flight_sequence)
msg.post(self.urls.gui, hash 'camera_did_change', { camera = 'CAMERA 2'})
end

function on_input(self, action_id, action)
Expand All @@ -45,8 +46,10 @@ function on_input(self, action_id, action)

if action_id == hash 'key_1' and action.released then
msg.post(self.urls.operator_1, hashes.activate)
msg.post(self.urls.gui, hash 'camera_did_change', { camera = 'CAMERA 1'})
elseif action_id == hash 'key_2' and action.released then
msg.post(self.urls.operator_2, hashes.activate)
msg.post(self.urls.gui, hash 'camera_did_change', { camera = 'CAMERA 2'})
elseif action_id == hash 'key_h' and action.released then
self.is_gui_enabled = not self.is_gui_enabled
msg.post(self.urls.gui, self.is_gui_enabled and hash('enable') or hash('disable'))
Expand Down

0 comments on commit f3d936f

Please sign in to comment.