From e00ab4f0a1b171800847928ff2482d50b5482551 Mon Sep 17 00:00:00 2001 From: Insality Date: Mon, 28 Sep 2020 22:11:09 +0300 Subject: [PATCH] Update grid example --- druid/system/druid_instance.lua | 4 +- example/gui/main/main.gui | 786 ++++++++++++++++++++++---------- 2 files changed, 542 insertions(+), 248 deletions(-) diff --git a/druid/system/druid_instance.lua b/druid/system/druid_instance.lua index f77ecec..f3c4c99 100644 --- a/druid/system/druid_instance.lua +++ b/druid/system/druid_instance.lua @@ -37,9 +37,9 @@ local text = require("druid.base.text") local checkbox = require("druid.extended.checkbox") local checkbox_group = require("druid.extended.checkbox_group") -local dynamic_grid = require("druid.base.dynamic_grid") +local dynamic_grid = require("druid.extended.dynamic_grid") local input = require("druid.extended.input") -local lang_text = require("druid.base.lang_text") +local lang_text = require("druid.extended.lang_text") local progress = require("druid.extended.progress") local radio_group = require("druid.extended.radio_group") local slider = require("druid.extended.slider") diff --git a/example/gui/main/main.gui b/example/gui/main/main.gui index e7d18f3..834027c 100644 --- a/example/gui/main/main.gui +++ b/example/gui/main/main.gui @@ -9659,7 +9659,7 @@ nodes { } size { x: 600.0 - y: 1800.0 + y: 2000.0 z: 0.0 w: 1.0 } @@ -9693,6 +9693,125 @@ nodes { template_node_child: false size_mode: SIZE_MODE_MANUAL } +nodes { + position { + x: 0.0 + y: -190.0 + z: 0.0 + w: 1.0 + } + rotation { + x: 0.0 + y: 0.0 + z: 0.0 + w: 1.0 + } + scale { + x: 0.6 + y: 0.6 + z: 1.0 + w: 1.0 + } + size { + x: 700.0 + y: 200.0 + z: 0.0 + w: 1.0 + } + color { + x: 0.0 + y: 0.0 + z: 0.0 + w: 1.0 + } + type: TYPE_TEXT + blend_mode: BLEND_MODE_ALPHA + text: "Tap on node for remove\n" + "Long tap on node for remove without node shift" + font: "game" + id: "text_grid_hint" + 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: true + parent: "grid_page_content" + layer: "" + inherit_alpha: true + alpha: 1.0 + outline_alpha: 0.0 + shadow_alpha: 0.0 + template_node_child: false + text_leading: 1.0 + text_tracking: 0.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: 1.0 + y: 1.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: "kenney/empty" + id: "info_grid_static" + xanchor: XANCHOR_NONE + yanchor: YANCHOR_NONE + pivot: PIVOT_CENTER + adjust_mode: ADJUST_MODE_FIT + parent: "grid_page_content" + 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: 0.0 @@ -9732,7 +9851,7 @@ nodes { yanchor: YANCHOR_NONE pivot: PIVOT_N adjust_mode: ADJUST_MODE_FIT - parent: "grid_page_content" + parent: "info_grid_static" layer: "" inherit_alpha: true slice9 { @@ -9836,7 +9955,7 @@ nodes { } type: TYPE_TEMPLATE id: "button_add" - parent: "grid_page_content" + parent: "info_grid_static" layer: "" inherit_alpha: true alpha: 1.0 @@ -9995,7 +10114,7 @@ nodes { } type: TYPE_TEMPLATE id: "button_clear" - parent: "grid_page_content" + parent: "info_grid_static" layer: "" inherit_alpha: true alpha: 1.0 @@ -10160,7 +10279,7 @@ nodes { yanchor: YANCHOR_NONE pivot: PIVOT_CENTER adjust_mode: ADJUST_MODE_FIT - parent: "grid_page_content" + parent: "info_grid_static" layer: "" inherit_alpha: true slice9 { @@ -10297,7 +10416,127 @@ nodes { nodes { position { x: 0.0 - y: -1320.0 + y: -853.0 + z: 0.0 + w: 1.0 + } + rotation { + x: 0.0 + y: 0.0 + z: 0.0 + w: 1.0 + } + scale { + x: 0.6 + y: 0.6 + z: 1.0 + w: 1.0 + } + size { + x: 800.0 + y: 200.0 + z: 0.0 + w: 1.0 + } + color { + x: 0.0 + y: 0.0 + z: 0.0 + w: 1.0 + } + type: TYPE_TEXT + blend_mode: BLEND_MODE_ALPHA + text: "This Dynamic Grid have pivot on South\n" + "\n" + "Nodes closer to the bottom, like in message app" + font: "game" + id: "text_grid_hint1" + 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: true + parent: "grid_page_content" + layer: "" + inherit_alpha: true + alpha: 1.0 + outline_alpha: 0.0 + shadow_alpha: 0.0 + template_node_child: false + text_leading: 0.7 + text_tracking: 0.0 +} +nodes { + position { + x: 0.0 + y: -935.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: 1.0 + y: 1.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: "kenney/empty" + id: "info_grid_dynamic" + xanchor: XANCHOR_NONE + yanchor: YANCHOR_NONE + pivot: PIVOT_CENTER + adjust_mode: ADJUST_MODE_FIT + parent: "grid_page_content" + 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: 0.0 + y: -567.0 z: 0.0 w: 1.0 } @@ -10333,7 +10572,7 @@ nodes { yanchor: YANCHOR_NONE pivot: PIVOT_S adjust_mode: ADJUST_MODE_FIT - parent: "grid_page_content" + parent: "info_grid_dynamic" layer: "" inherit_alpha: true slice9 { @@ -10407,7 +10646,7 @@ nodes { nodes { position { x: 0.0 - y: -864.0 + y: -111.0 z: 0.0 w: 1.0 } @@ -10443,172 +10682,7 @@ nodes { yanchor: YANCHOR_NONE pivot: PIVOT_CENTER adjust_mode: ADJUST_MODE_FIT - parent: "grid_page_content" - layer: "" - inherit_alpha: true - slice9 { - x: 20.0 - y: 20.0 - z: 20.0 - w: 20.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: -250.0 - y: -1464.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: 500.0 - y: 100.0 - z: 0.0 - w: 1.0 - } - color { - x: 0.9019608 - y: 0.9019608 - z: 0.7019608 - w: 1.0 - } - type: TYPE_BOX - blend_mode: BLEND_MODE_ALPHA - texture: "" - id: "grid_dynamic_hor_view" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_W - adjust_mode: ADJUST_MODE_FIT - parent: "grid_page_content" - 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: 1.0 - template_node_child: false - size_mode: SIZE_MODE_MANUAL -} -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: 500.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: "kenney/empty" - id: "grid_dynamic_hor_nodes" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_W - adjust_mode: ADJUST_MODE_FIT - parent: "grid_dynamic_hor_view" - 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: 0.0 - y: -1473.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: 80.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: "kenney/button_red" - id: "grid_dynamic_hor_prefab" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "grid_page_content" + parent: "info_grid_dynamic" layer: "" inherit_alpha: true slice9 { @@ -10627,7 +10701,7 @@ nodes { nodes { position { x: -60.0 - y: -784.0 + y: -31.0 z: 0.0 w: 1.0 } @@ -10657,7 +10731,7 @@ nodes { } type: TYPE_TEMPLATE id: "button_add_start_dynamic" - parent: "grid_page_content" + parent: "info_grid_dynamic" layer: "" inherit_alpha: true alpha: 1.0 @@ -10786,7 +10860,7 @@ nodes { nodes { position { x: 60.0 - y: -784.0 + y: -31.0 z: 0.0 w: 1.0 } @@ -10816,7 +10890,7 @@ nodes { } type: TYPE_TEMPLATE id: "button_add_end_dynamic" - parent: "grid_page_content" + parent: "info_grid_dynamic" layer: "" inherit_alpha: true alpha: 1.0 @@ -10942,10 +11016,294 @@ nodes { text_leading: 1.0 text_tracking: 0.0 } +nodes { + position { + x: 0.0 + y: -1583.0 + z: 0.0 + w: 1.0 + } + rotation { + x: 0.0 + y: 0.0 + z: 0.0 + w: 1.0 + } + scale { + x: 0.6 + y: 0.6 + z: 1.0 + w: 1.0 + } + size { + x: 700.0 + y: 200.0 + z: 0.0 + w: 1.0 + } + color { + x: 0.0 + y: 0.0 + z: 0.0 + w: 1.0 + } + type: TYPE_TEXT + blend_mode: BLEND_MODE_ALPHA + text: "Horizontal Dynamic Grid Example\n" + "Pivot point at West" + font: "game" + id: "text_grid_hint2" + 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: true + parent: "grid_page_content" + layer: "" + inherit_alpha: true + alpha: 1.0 + outline_alpha: 0.0 + shadow_alpha: 0.0 + template_node_child: false + text_leading: 1.0 + text_tracking: 0.0 +} +nodes { + position { + x: 0.0 + y: -1637.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: 1.0 + y: 1.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: "kenney/empty" + id: "info_grid_dynamic_hor" + xanchor: XANCHOR_NONE + yanchor: YANCHOR_NONE + pivot: PIVOT_CENTER + adjust_mode: ADJUST_MODE_FIT + parent: "grid_page_content" + 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: -250.0 + y: -126.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: 500.0 + y: 100.0 + z: 0.0 + w: 1.0 + } + color { + x: 0.9019608 + y: 0.9019608 + z: 0.7019608 + w: 1.0 + } + type: TYPE_BOX + blend_mode: BLEND_MODE_ALPHA + texture: "" + id: "grid_dynamic_hor_view" + xanchor: XANCHOR_NONE + yanchor: YANCHOR_NONE + pivot: PIVOT_W + adjust_mode: ADJUST_MODE_FIT + parent: "info_grid_dynamic_hor" + 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: 1.0 + template_node_child: false + size_mode: SIZE_MODE_MANUAL +} +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: 500.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: "kenney/empty" + id: "grid_dynamic_hor_nodes" + xanchor: XANCHOR_NONE + yanchor: YANCHOR_NONE + pivot: PIVOT_W + adjust_mode: ADJUST_MODE_FIT + parent: "grid_dynamic_hor_view" + 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: 0.0 + y: -135.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: 80.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: "kenney/button_red" + id: "grid_dynamic_hor_prefab" + xanchor: XANCHOR_NONE + yanchor: YANCHOR_NONE + pivot: PIVOT_CENTER + adjust_mode: ADJUST_MODE_FIT + parent: "info_grid_dynamic_hor" + layer: "" + inherit_alpha: true + slice9 { + x: 20.0 + y: 20.0 + z: 20.0 + w: 20.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: -60.0 - y: -1375.0 + y: -37.0 z: 0.0 w: 1.0 } @@ -10975,7 +11333,7 @@ nodes { } type: TYPE_TEMPLATE id: "button_add_start_dynamic_hor" - parent: "grid_page_content" + parent: "info_grid_dynamic_hor" layer: "" inherit_alpha: true alpha: 1.0 @@ -11104,7 +11462,7 @@ nodes { nodes { position { x: 60.0 - y: -1375.0 + y: -37.0 z: 0.0 w: 1.0 } @@ -11134,7 +11492,7 @@ nodes { } type: TYPE_TEMPLATE id: "button_add_end_dynamic_hor" - parent: "grid_page_content" + parent: "info_grid_dynamic_hor" layer: "" inherit_alpha: true alpha: 1.0 @@ -11260,70 +11618,6 @@ nodes { text_leading: 1.0 text_tracking: 0.0 } -nodes { - position { - x: -200.0 - y: -180.0 - z: 0.0 - w: 1.0 - } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - scale { - x: 0.75 - y: 0.75 - z: 1.0 - w: 1.0 - } - size { - x: 533.33 - y: 200.0 - z: 0.0 - w: 1.0 - } - color { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - type: TYPE_TEXT - blend_mode: BLEND_MODE_ALPHA - text: "Tap on node for remove\n" - "Long tap on node for remove without node shift" - font: "game" - id: "text_grid_hint" - 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: true - parent: "grid_page_content" - layer: "" - inherit_alpha: true - alpha: 1.0 - outline_alpha: 0.0 - shadow_alpha: 0.0 - template_node_child: false - text_leading: 1.0 - text_tracking: 0.0 -} nodes { position { x: 0.0