Cleanup of code, and added better example gui
This commit is contained in:
BIN
main/images/camera.png
Normal file
BIN
main/images/camera.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
9
main/images/icons.atlas
Normal file
9
main/images/icons.atlas
Normal file
@@ -0,0 +1,9 @@
|
||||
images {
|
||||
image: "/main/images/camera.png"
|
||||
}
|
||||
images {
|
||||
image: "/main/images/qrcode.png"
|
||||
}
|
||||
margin: 0
|
||||
extrude_borders: 0
|
||||
inner_padding: 0
|
BIN
main/images/qrcode.png
Normal file
BIN
main/images/qrcode.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
@@ -1,7 +1,7 @@
|
||||
name: "main"
|
||||
scale_along_z: 0
|
||||
embedded_instances {
|
||||
id: "go"
|
||||
id: "controller"
|
||||
data: "components {\n"
|
||||
" id: \"script\"\n"
|
||||
" component: \"/main/main.script\"\n"
|
||||
@@ -40,7 +40,7 @@ embedded_instances {
|
||||
""
|
||||
position {
|
||||
x: 480.0
|
||||
y: 640.0
|
||||
y: 772.055
|
||||
z: 0.0
|
||||
}
|
||||
rotation {
|
||||
@@ -58,114 +58,6 @@ embedded_instances {
|
||||
embedded_instances {
|
||||
id: "logo"
|
||||
data: "embedded_components {\n"
|
||||
" id: \"label\"\n"
|
||||
" type: \"label\"\n"
|
||||
" data: \"size {\\n"
|
||||
" x: 128.0\\n"
|
||||
" y: 32.0\\n"
|
||||
" z: 0.0\\n"
|
||||
" w: 0.0\\n"
|
||||
"}\\n"
|
||||
"scale {\\n"
|
||||
" x: 1.0\\n"
|
||||
" y: 1.0\\n"
|
||||
" z: 1.0\\n"
|
||||
" w: 0.0\\n"
|
||||
"}\\n"
|
||||
"color {\\n"
|
||||
" x: 1.0\\n"
|
||||
" y: 1.0\\n"
|
||||
" z: 1.0\\n"
|
||||
" w: 1.0\\n"
|
||||
"}\\n"
|
||||
"outline {\\n"
|
||||
" x: 0.0\\n"
|
||||
" y: 0.0\\n"
|
||||
" z: 0.0\\n"
|
||||
" w: 1.0\\n"
|
||||
"}\\n"
|
||||
"shadow {\\n"
|
||||
" x: 0.0\\n"
|
||||
" y: 0.0\\n"
|
||||
" z: 0.0\\n"
|
||||
" w: 1.0\\n"
|
||||
"}\\n"
|
||||
"leading: 1.0\\n"
|
||||
"tracking: 0.0\\n"
|
||||
"pivot: PIVOT_E\\n"
|
||||
"blend_mode: BLEND_MODE_ALPHA\\n"
|
||||
"line_break: false\\n"
|
||||
"text: \\\"QRCode: \\\"\\n"
|
||||
"font: \\\"/dirtylarry/larryfont.font\\\"\\n"
|
||||
"material: \\\"/builtins/fonts/label-df.material\\\"\\n"
|
||||
"\"\n"
|
||||
" position {\n"
|
||||
" x: 200.54617\n"
|
||||
" y: 47.57482\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: \"qrcode\"\n"
|
||||
" type: \"label\"\n"
|
||||
" data: \"size {\\n"
|
||||
" x: 128.0\\n"
|
||||
" y: 32.0\\n"
|
||||
" z: 0.0\\n"
|
||||
" w: 0.0\\n"
|
||||
"}\\n"
|
||||
"scale {\\n"
|
||||
" x: 1.0\\n"
|
||||
" y: 1.0\\n"
|
||||
" z: 1.0\\n"
|
||||
" w: 0.0\\n"
|
||||
"}\\n"
|
||||
"color {\\n"
|
||||
" x: 1.0\\n"
|
||||
" y: 1.0\\n"
|
||||
" z: 1.0\\n"
|
||||
" w: 1.0\\n"
|
||||
"}\\n"
|
||||
"outline {\\n"
|
||||
" x: 0.0\\n"
|
||||
" y: 0.0\\n"
|
||||
" z: 0.0\\n"
|
||||
" w: 1.0\\n"
|
||||
"}\\n"
|
||||
"shadow {\\n"
|
||||
" x: 0.0\\n"
|
||||
" y: 0.0\\n"
|
||||
" z: 0.0\\n"
|
||||
" w: 1.0\\n"
|
||||
"}\\n"
|
||||
"leading: 1.0\\n"
|
||||
"tracking: 0.0\\n"
|
||||
"pivot: PIVOT_NW\\n"
|
||||
"blend_mode: BLEND_MODE_ALPHA\\n"
|
||||
"line_break: true\\n"
|
||||
"text: \\\"...\\\"\\n"
|
||||
"font: \\\"/dirtylarry/larryfont.font\\\"\\n"
|
||||
"material: \\\"/builtins/fonts/label-df.material\\\"\\n"
|
||||
"\"\n"
|
||||
" position {\n"
|
||||
" x: 73.19203\n"
|
||||
" y: 21.95761\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: \"sprite\"\n"
|
||||
" type: \"sprite\"\n"
|
||||
" data: \"tile_set: \\\"/main/logo.atlas\\\"\\n"
|
||||
@@ -203,3 +95,38 @@ embedded_instances {
|
||||
z: 1.0
|
||||
}
|
||||
}
|
||||
embedded_instances {
|
||||
id: "gui"
|
||||
data: "components {\n"
|
||||
" id: \"main\"\n"
|
||||
" component: \"/main/main.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
|
||||
}
|
||||
}
|
||||
|
943
main/main.gui
Normal file
943
main/main.gui
Normal file
@@ -0,0 +1,943 @@
|
||||
script: "/main/main.gui_script"
|
||||
fonts {
|
||||
name: "larryfont"
|
||||
font: "/dirtylarry/larryfont.font"
|
||||
}
|
||||
textures {
|
||||
name: "icons"
|
||||
texture: "/main/images/icons.atlas"
|
||||
}
|
||||
textures {
|
||||
name: "camera"
|
||||
texture: "/main/camera.atlas"
|
||||
}
|
||||
background_color {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.0
|
||||
w: 0.0
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 474.796
|
||||
y: 606.683
|
||||
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: 64.0
|
||||
y: 64.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
color {
|
||||
x: 0.101960786
|
||||
y: 0.101960786
|
||||
z: 0.101960786
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
texture: ""
|
||||
id: "background"
|
||||
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
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 178.793
|
||||
y: 1190.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: 200.0
|
||||
y: 100.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
color {
|
||||
x: 1.0
|
||||
y: 1.0
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "scan_bn"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
alpha: 1.0
|
||||
template: "/dirtylarry/button.gui"
|
||||
template_node_child: false
|
||||
}
|
||||
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: 300.0
|
||||
y: 88.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: "button/button_normal"
|
||||
id: "scan_bn/larrybutton"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_CENTER
|
||||
adjust_mode: ADJUST_MODE_FIT
|
||||
parent: "scan_bn"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
z: 32.0
|
||||
w: 32.0
|
||||
}
|
||||
clipping_mode: CLIPPING_MODE_NONE
|
||||
clipping_visible: true
|
||||
clipping_inverted: false
|
||||
alpha: 1.0
|
||||
template_node_child: true
|
||||
size_mode: SIZE_MODE_MANUAL
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -34.921
|
||||
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: 200.0
|
||||
y: 100.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: "Scan\n"
|
||||
""
|
||||
font: "larryfont"
|
||||
id: "scan_bn/larrylabel"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_CENTER
|
||||
outline {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.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: "scan_bn/larrybutton"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
alpha: 1.0
|
||||
outline_alpha: 1.0
|
||||
shadow_alpha: 1.0
|
||||
overridden_fields: 1
|
||||
overridden_fields: 8
|
||||
template_node_child: true
|
||||
text_leading: 1.0
|
||||
text_tracking: 0.0
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 780.0
|
||||
y: 1190.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: 200.0
|
||||
y: 100.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
color {
|
||||
x: 1.0
|
||||
y: 1.0
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "generate_bn"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
alpha: 1.0
|
||||
template: "/dirtylarry/button.gui"
|
||||
template_node_child: false
|
||||
}
|
||||
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: 300.0
|
||||
y: 88.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: "button/button_normal"
|
||||
id: "generate_bn/larrybutton"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_CENTER
|
||||
adjust_mode: ADJUST_MODE_FIT
|
||||
parent: "generate_bn"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
z: 32.0
|
||||
w: 32.0
|
||||
}
|
||||
clipping_mode: CLIPPING_MODE_NONE
|
||||
clipping_visible: true
|
||||
clipping_inverted: false
|
||||
alpha: 1.0
|
||||
template_node_child: true
|
||||
size_mode: SIZE_MODE_MANUAL
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -30.73
|
||||
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: 200.0
|
||||
y: 100.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: "QRCode"
|
||||
font: "larryfont"
|
||||
id: "generate_bn/larrylabel"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_CENTER
|
||||
outline {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.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: "generate_bn/larrybutton"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
alpha: 1.0
|
||||
outline_alpha: 1.0
|
||||
shadow_alpha: 1.0
|
||||
overridden_fields: 1
|
||||
overridden_fields: 8
|
||||
template_node_child: true
|
||||
text_leading: 1.0
|
||||
text_tracking: 0.0
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 243.047
|
||||
y: 1190.751
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
rotation {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
scale {
|
||||
x: 0.25
|
||||
y: 0.25
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
size {
|
||||
x: 256.0
|
||||
y: 256.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: "icons/camera"
|
||||
id: "camera_icon"
|
||||
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_AUTO
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 866.031
|
||||
y: 1190.751
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
rotation {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
scale {
|
||||
x: 0.25
|
||||
y: 0.25
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
size {
|
||||
x: 256.0
|
||||
y: 256.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: "icons/qrcode"
|
||||
id: "camera_icon1"
|
||||
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_AUTO
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 476.318
|
||||
y: 811.556
|
||||
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: 100.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: "camera/logo"
|
||||
id: "camera"
|
||||
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
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 476.318
|
||||
y: 811.556
|
||||
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: 100.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: "camera/logo"
|
||||
id: "qrcode"
|
||||
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
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 124.016
|
||||
y: 181.747
|
||||
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: 200.0
|
||||
y: 100.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
color {
|
||||
x: 1.0
|
||||
y: 1.0
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "url"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
alpha: 1.0
|
||||
template: "/dirtylarry/input.gui"
|
||||
template_node_child: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -43.71
|
||||
y: -68.422
|
||||
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: 800.0
|
||||
y: 72.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: "button/button_pressed"
|
||||
id: "url/bg"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_W
|
||||
adjust_mode: ADJUST_MODE_FIT
|
||||
parent: "url"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
z: 32.0
|
||||
w: 32.0
|
||||
}
|
||||
clipping_mode: CLIPPING_MODE_NONE
|
||||
clipping_visible: true
|
||||
clipping_inverted: false
|
||||
alpha: 1.0
|
||||
overridden_fields: 1
|
||||
overridden_fields: 4
|
||||
template_node_child: true
|
||||
size_mode: SIZE_MODE_MANUAL
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 13.0
|
||||
y: 3.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: 0.0
|
||||
y: 32.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
color {
|
||||
x: 0.18431373
|
||||
y: 0.18431373
|
||||
z: 0.18431373
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
texture: ""
|
||||
id: "url/inner"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_W
|
||||
adjust_mode: ADJUST_MODE_FIT
|
||||
parent: "url/bg"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.0
|
||||
w: 0.0
|
||||
}
|
||||
clipping_mode: CLIPPING_MODE_STENCIL
|
||||
clipping_visible: true
|
||||
clipping_inverted: false
|
||||
alpha: 0.0
|
||||
template_node_child: true
|
||||
size_mode: SIZE_MODE_MANUAL
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 8.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: 0.0
|
||||
y: 48.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
color {
|
||||
x: 0.3254902
|
||||
y: 0.6666667
|
||||
z: 0.9960785
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
texture: ""
|
||||
id: "url/cursor"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_W
|
||||
adjust_mode: ADJUST_MODE_FIT
|
||||
parent: "url/inner"
|
||||
layer: ""
|
||||
inherit_alpha: false
|
||||
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: true
|
||||
size_mode: SIZE_MODE_MANUAL
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 4.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: 200.0
|
||||
y: 32.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: ""
|
||||
font: "larryfont"
|
||||
id: "url/content"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_W
|
||||
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: "url/inner"
|
||||
layer: ""
|
||||
inherit_alpha: false
|
||||
alpha: 1.0
|
||||
outline_alpha: 1.0
|
||||
shadow_alpha: 1.0
|
||||
overridden_fields: 8
|
||||
template_node_child: true
|
||||
text_leading: 1.0
|
||||
text_tracking: 0.0
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 96.219
|
||||
y: 113.325
|
||||
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: 200.0
|
||||
y: 100.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: ""
|
||||
font: "larryfont"
|
||||
id: "text"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_W
|
||||
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
|
||||
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
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
max_nodes: 512
|
76
main/main.gui_script
Normal file
76
main/main.gui_script
Normal file
@@ -0,0 +1,76 @@
|
||||
local dirtylarry = require "dirtylarry/dirtylarry"
|
||||
|
||||
function init(self)
|
||||
msg.post(".", "acquire_input_focus")
|
||||
|
||||
local logosize = 256
|
||||
local screen_width = sys.get_config("display.width", 600)
|
||||
local screen_height = sys.get_config("display.height", 800)
|
||||
local scale_width = screen_width / logosize
|
||||
local scale_height = screen_height / logosize
|
||||
|
||||
local bg = gui.get_node("background")
|
||||
gui.set_position(bg, vmath.vector3(screen_width/2, screen_height/2, 0))
|
||||
gui.set_size(bg, vmath.vector3(screen_width, screen_height, 0))
|
||||
|
||||
local camera = gui.get_node("camera")
|
||||
gui.set_position(camera, vmath.vector3(screen_width/2, screen_height/2, 0))
|
||||
gui.set_size(camera, vmath.vector3(screen_width/2, screen_height/2, 0))
|
||||
|
||||
local qrcode = gui.get_node("qrcode")
|
||||
gui.set_position(qrcode, vmath.vector3(screen_width/2, screen_height/2, 0))
|
||||
gui.set_size(qrcode, vmath.vector3(screen_width/2, screen_height/2, 0))
|
||||
|
||||
local n = gui.get_node("scan_bn/larrylabel")
|
||||
self.scan_label_pos = gui.get_position(n)
|
||||
|
||||
n = gui.get_node("generate_bn/larrylabel")
|
||||
self.generate_label_pos = gui.get_position(n)
|
||||
end
|
||||
|
||||
function final(self)
|
||||
-- Add finalization code here
|
||||
-- Remove this function if not needed
|
||||
end
|
||||
|
||||
function update(self, dt)
|
||||
-- Add update code here
|
||||
-- Remove this function if not needed
|
||||
end
|
||||
|
||||
local function set_text(self, text)
|
||||
local n = gui.get_node("text")
|
||||
gui.set_text(n, text)
|
||||
end
|
||||
|
||||
function on_message(self, message_id, message, sender)
|
||||
if message_id == hash("set_text") then
|
||||
set_text(self, message.text)
|
||||
end
|
||||
end
|
||||
|
||||
local function isempty(s)
|
||||
return s == nil or s == ''
|
||||
end
|
||||
|
||||
function on_input(self, action_id, action)
|
||||
dirtylarry:button("scan_bn", action_id, action, function ()
|
||||
msg.post("controller", "click", {mode="SCAN"})
|
||||
end)
|
||||
dirtylarry:button("generate_bn", action_id, action, function ()
|
||||
local text = sys.get_sys_info().device_ident
|
||||
if isempty(text) then
|
||||
text = "DEFOLD RULES!"
|
||||
end
|
||||
set_text(self, text)
|
||||
msg.post("controller", "click", {mode="GENERATE", text=text})
|
||||
end)
|
||||
|
||||
-- for some reason, the text recenters, and I don't want that
|
||||
local n = gui.get_node("scan_bn/larrylabel")
|
||||
gui.set_position(n, self.scan_label_pos)
|
||||
|
||||
n = gui.get_node("generate_bn/larrylabel")
|
||||
gui.set_position(n, self.generate_label_pos)
|
||||
end
|
||||
|
153
main/main.script
153
main/main.script
@@ -1,19 +1,9 @@
|
||||
|
||||
function init(self)
|
||||
msg.post(".", "acquire_input_focus")
|
||||
|
||||
local logosize = 128
|
||||
local screen_width = sys.get_config("display.width", 600)
|
||||
local screen_height = sys.get_config("display.height", 800)
|
||||
local scale_width = screen_width / logosize
|
||||
local scale_height = screen_height / logosize
|
||||
|
||||
go.set("#sprite", "scale", vmath.vector3(scale_width, scale_height, 1) )
|
||||
|
||||
local function start_scan(self)
|
||||
if camera ~= nil then
|
||||
|
||||
local sysinfo = sys.get_sys_info()
|
||||
|
||||
|
||||
local quality = camera.CAPTURE_QUALITY_HIGH
|
||||
local type = camera.CAMERA_TYPE_FRONT
|
||||
self.flip = 0
|
||||
@@ -22,88 +12,105 @@ function init(self)
|
||||
quality = camera.CAPTURE_QUALITY_MEDIUM
|
||||
self.flip = 1
|
||||
end
|
||||
|
||||
|
||||
if camera.start_capture(type, quality) then
|
||||
self.cameraframe = camera.get_frame()
|
||||
self.camerainfo = camera.get_info()
|
||||
print("Initialized camera")
|
||||
pprint(self.camerainfo)
|
||||
|
||||
self.cameratextureheader = {width=self.camerainfo.width,
|
||||
height=self.camerainfo.height,
|
||||
type=resource.TEXTURE_TYPE_2D,
|
||||
format=resource.TEXTURE_FORMAT_RGB,
|
||||
num_mip_maps=1 }
|
||||
|
||||
|
||||
self.debugtextureheader = {width=self.camerainfo.width,
|
||||
height=self.camerainfo.height,
|
||||
type=resource.TEXTURE_TYPE_2D,
|
||||
format=resource.TEXTURE_FORMAT_RGB,
|
||||
num_mip_maps=1 }
|
||||
self.cameraframe = camera.get_frame()
|
||||
self.camerainfo = camera.get_info()
|
||||
print("Initialized camera")
|
||||
self.cameratextureheader = {width=self.camerainfo.width,
|
||||
height=self.camerainfo.height,
|
||||
type=resource.TEXTURE_TYPE_2D,
|
||||
format=resource.TEXTURE_FORMAT_RGB,
|
||||
num_mip_maps=1 }
|
||||
|
||||
self.debugtextureheader = {width=self.camerainfo.width,
|
||||
height=self.camerainfo.height,
|
||||
type=resource.TEXTURE_TYPE_2D,
|
||||
format=resource.TEXTURE_FORMAT_RGB,
|
||||
num_mip_maps=1 }
|
||||
end
|
||||
else
|
||||
print("could not start camera capture")
|
||||
end
|
||||
end
|
||||
|
||||
local function end_scan(self)
|
||||
if self.cameraframe ~= nil then
|
||||
self.cameraframe = nil
|
||||
camera.stop_capture()
|
||||
self.first = 0
|
||||
end
|
||||
end
|
||||
|
||||
local function update_scan(self)
|
||||
|
||||
if self.cameraframe ~= nil then
|
||||
local pathmodelcamera = go.get("#sprite", "texture0")
|
||||
resource.set_texture(pathmodelcamera, self.cameratextureheader, self.cameraframe)
|
||||
|
||||
local text = qrcode.scan(self.cameraframe, self.camerainfo.width, self.camerainfo.height, self.flip)
|
||||
|
||||
if text ~= nil then
|
||||
msg.post("gui", "set_text", {text=text})
|
||||
end_scan(self)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function generate_qrcode(self, text)
|
||||
--self.qrcode =
|
||||
end
|
||||
|
||||
function init(self)
|
||||
local logosize = 256
|
||||
local screen_width = sys.get_config("display.width", 600)
|
||||
local screen_height = sys.get_config("display.height", 800)
|
||||
local scale_width = screen_width / logosize
|
||||
local scale_height = screen_height / logosize
|
||||
|
||||
go.set("#sprite", "scale", vmath.vector3(scale_width, scale_height, 1) )
|
||||
|
||||
start_scan(self)
|
||||
|
||||
if qrcode == nil then
|
||||
print("could not find qrcode module")
|
||||
end
|
||||
|
||||
self.mode = "SCAN"
|
||||
end
|
||||
|
||||
function final(self)
|
||||
if self.cameraframe ~= nil then
|
||||
camera.stop_capture()
|
||||
end
|
||||
end_scan(self)
|
||||
end
|
||||
|
||||
local first = 1
|
||||
|
||||
function update(self, dt)
|
||||
|
||||
if first == 0 then
|
||||
first = 1
|
||||
|
||||
|
||||
local img = resource.load("/main/images/defold.png")
|
||||
local text = qrcode.scan(self.cameraframe, self.camerainfo.width, self.camerainfo.height, img)
|
||||
if text ~= nil then
|
||||
label.set_text("logo#qrcode", text)
|
||||
end
|
||||
|
||||
local path = go.get("logo#sprite", "texture0")
|
||||
local image = qrcode.get_debug_image()
|
||||
if image ~= nil then
|
||||
resource.set_texture(path, self.debugtextureheader, image)
|
||||
end
|
||||
end
|
||||
|
||||
if self.cameraframe then
|
||||
local pathmodelcamera = go.get("#sprite", "texture0")
|
||||
resource.set_texture(pathmodelcamera, self.cameratextureheader, self.cameraframe)
|
||||
|
||||
local text = qrcode.scan(self.cameraframe, self.camerainfo.width, self.camerainfo.height, self.flip)
|
||||
|
||||
if text ~= nil then
|
||||
label.set_text("logo#qrcode", text)
|
||||
end
|
||||
|
||||
local path = go.get("logo#sprite", "texture0")
|
||||
local image = qrcode.get_debug_image()
|
||||
if image ~= nil then
|
||||
resource.set_texture(path, self.debugtextureheader, image)
|
||||
end
|
||||
end
|
||||
|
||||
if self.mode == "SCAN" then
|
||||
update_scan(self)
|
||||
end
|
||||
end
|
||||
|
||||
function on_input(self, action_id, action)
|
||||
if action_id == hash("click") or action_id == hash("touch") then
|
||||
pprint(action)
|
||||
label.set_text("logo#qrcode", "...")
|
||||
--pprint(action)
|
||||
--label.set_text("logo#qrcode", "...")
|
||||
print("foo")
|
||||
end
|
||||
end
|
||||
|
||||
function on_message(self, message_id, message)
|
||||
if self.mode ~= message.mode then
|
||||
if message.mode == "SCAN" then
|
||||
start_scan(self)
|
||||
|
||||
pprint(self.cameraframe)
|
||||
else
|
||||
end_scan(self)
|
||||
generate_qrcode(self)
|
||||
end
|
||||
self.mode = message.mode
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user