diff --git a/example/kenney/assets/fonts/exo2.ttf b/example/assets/fonts/exo2.ttf similarity index 100% rename from example/kenney/assets/fonts/exo2.ttf rename to example/assets/fonts/exo2.ttf diff --git a/example/kenney/assets/fonts/game.font b/example/assets/fonts/game.font similarity index 87% rename from example/kenney/assets/fonts/game.font rename to example/assets/fonts/game.font index 5cc90eb..fda7575 100644 --- a/example/kenney/assets/fonts/game.font +++ b/example/assets/fonts/game.font @@ -1,4 +1,4 @@ -font: "/example/kenney/assets/fonts/exo2.ttf" +font: "/example/assets/fonts/exo2.ttf" material: "/builtins/fonts/font-df.material" size: 40 antialias: 1 diff --git a/example/kenney/assets/images/back/back_blue.png b/example/assets/images/back/back_blue.png similarity index 100% rename from example/kenney/assets/images/back/back_blue.png rename to example/assets/images/back/back_blue.png diff --git a/example/kenney/assets/images/back/back_gray.png b/example/assets/images/back/back_gray.png similarity index 100% rename from example/kenney/assets/images/back/back_gray.png rename to example/assets/images/back/back_gray.png diff --git a/example/kenney/assets/images/back/back_green.png b/example/assets/images/back/back_green.png similarity index 100% rename from example/kenney/assets/images/back/back_green.png rename to example/assets/images/back/back_green.png diff --git a/example/kenney/assets/images/back/back_red.png b/example/assets/images/back/back_red.png similarity index 100% rename from example/kenney/assets/images/back/back_red.png rename to example/assets/images/back/back_red.png diff --git a/example/kenney/assets/images/buttons/button_blue.png b/example/assets/images/buttons/button_blue.png similarity index 100% rename from example/kenney/assets/images/buttons/button_blue.png rename to example/assets/images/buttons/button_blue.png diff --git a/example/kenney/assets/images/buttons/button_green.png b/example/assets/images/buttons/button_green.png similarity index 100% rename from example/kenney/assets/images/buttons/button_green.png rename to example/assets/images/buttons/button_green.png diff --git a/example/kenney/assets/images/buttons/button_red.png b/example/assets/images/buttons/button_red.png similarity index 100% rename from example/kenney/assets/images/buttons/button_red.png rename to example/assets/images/buttons/button_red.png diff --git a/example/kenney/assets/images/buttons/button_yellow.png b/example/assets/images/buttons/button_yellow.png similarity index 100% rename from example/kenney/assets/images/buttons/button_yellow.png rename to example/assets/images/buttons/button_yellow.png diff --git a/example/kenney/assets/images/empty.png b/example/assets/images/empty.png similarity index 100% rename from example/kenney/assets/images/empty.png rename to example/assets/images/empty.png diff --git a/example/assets/images/kenney.atlas b/example/assets/images/kenney.atlas new file mode 100644 index 0000000..622bf0d --- /dev/null +++ b/example/assets/images/kenney.atlas @@ -0,0 +1,79 @@ +images { + image: "/example/assets/images/back/back_blue.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/back/back_gray.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/back/back_green.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/back/back_red.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/buttons/button_green.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/buttons/button_red.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/buttons/button_yellow.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/empty.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/progress/progress_back.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/progress/progress_fill_green.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/progress/progress_fill_red.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/progress/progress_fill_yellow.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/radio/check_back_circle.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/radio/check_back_square.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/radio/checkmark.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/radio/tick.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/slider/slider_back.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/slider/slider_move.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +images { + image: "/example/assets/images/buttons/button_blue.png" + sprite_trim_mode: SPRITE_TRIM_MODE_OFF +} +margin: 0 +extrude_borders: 2 +inner_padding: 0 diff --git a/example/kenney/assets/images/progress/progress_back.png b/example/assets/images/progress/progress_back.png similarity index 100% rename from example/kenney/assets/images/progress/progress_back.png rename to example/assets/images/progress/progress_back.png diff --git a/example/kenney/assets/images/progress/progress_fill_green.png b/example/assets/images/progress/progress_fill_green.png similarity index 100% rename from example/kenney/assets/images/progress/progress_fill_green.png rename to example/assets/images/progress/progress_fill_green.png diff --git a/example/kenney/assets/images/progress/progress_fill_red.png b/example/assets/images/progress/progress_fill_red.png similarity index 100% rename from example/kenney/assets/images/progress/progress_fill_red.png rename to example/assets/images/progress/progress_fill_red.png diff --git a/example/kenney/assets/images/progress/progress_fill_yellow.png b/example/assets/images/progress/progress_fill_yellow.png similarity index 100% rename from example/kenney/assets/images/progress/progress_fill_yellow.png rename to example/assets/images/progress/progress_fill_yellow.png diff --git a/example/kenney/assets/images/radio/check_back_circle.png b/example/assets/images/radio/check_back_circle.png similarity index 100% rename from example/kenney/assets/images/radio/check_back_circle.png rename to example/assets/images/radio/check_back_circle.png diff --git a/example/kenney/assets/images/radio/check_back_square.png b/example/assets/images/radio/check_back_square.png similarity index 100% rename from example/kenney/assets/images/radio/check_back_square.png rename to example/assets/images/radio/check_back_square.png diff --git a/example/kenney/assets/images/radio/checkmark.png b/example/assets/images/radio/checkmark.png similarity index 100% rename from example/kenney/assets/images/radio/checkmark.png rename to example/assets/images/radio/checkmark.png diff --git a/example/kenney/assets/images/radio/tick.png b/example/assets/images/radio/tick.png similarity index 100% rename from example/kenney/assets/images/radio/tick.png rename to example/assets/images/radio/tick.png diff --git a/example/kenney/assets/images/slider/slider_back.png b/example/assets/images/slider/slider_back.png similarity index 100% rename from example/kenney/assets/images/slider/slider_back.png rename to example/assets/images/slider/slider_back.png diff --git a/example/kenney/assets/images/slider/slider_move.png b/example/assets/images/slider/slider_move.png similarity index 100% rename from example/kenney/assets/images/slider/slider_move.png rename to example/assets/images/slider/slider_move.png diff --git a/example/kenney/assets/sounds/click.ogg b/example/assets/sounds/click.ogg similarity index 100% rename from example/kenney/assets/sounds/click.ogg rename to example/assets/sounds/click.ogg diff --git a/example/example.collection b/example/example.collection deleted file mode 100644 index 3b0c850..0000000 --- a/example/example.collection +++ /dev/null @@ -1,79 +0,0 @@ -name: "main" -scale_along_z: 0 -embedded_instances { - id: "go" - data: "components {\n" - " id: \"example\"\n" - " component: \"/example/example.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 - } -} -embedded_instances { - id: "sounds" - data: "embedded_components {\n" - " id: \"click\"\n" - " type: \"sound\"\n" - " data: \"sound: \\\"/example/res/click.ogg\\\"\\n" - "looping: 0\\n" - "group: \\\"master\\\"\\n" - "gain: 0.4\\n" - "pan: 0.0\\n" - "speed: 1.0\\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 - } -} diff --git a/example/example.gui b/example/example.gui deleted file mode 100644 index 4c938ae..0000000 --- a/example/example.gui +++ /dev/null @@ -1,1660 +0,0 @@ -script: "/example/example.gui.gui_script" -fonts { - name: "game" - font: "/example/game.font" -} -textures { - name: "gui" - texture: "/example/gui.atlas" -} -background_color { - x: 0.0 - y: 0.0 - z: 0.0 - w: 0.0 -} -nodes { - position { - x: 300.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: "gui/empty" - id: "control" - 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: -150.0 - y: 50.0 - z: 0.0 - w: 1.0 - } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - scale { - x: 0.5 - y: 0.5 - z: 1.0 - w: 1.0 - } - size { - x: 426.0 - y: 190.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: "gui/green_long" - id: "prev" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "control" - 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: 20.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: "Prev" - font: "game" - id: "prev_text" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - outline { - x: 1.0 - y: 1.0 - z: 1.0 - w: 1.0 - } - shadow { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - adjust_mode: ADJUST_MODE_FIT - line_break: false - parent: "prev" - 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 -} -nodes { - position { - x: 150.0 - y: 50.0 - z: 0.0 - w: 1.0 - } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - scale { - x: 0.5 - y: 0.5 - z: 1.0 - w: 1.0 - } - size { - x: 426.0 - y: 190.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: "gui/green_long" - id: "next" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "control" - 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: 20.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: "Next" - font: "game" - id: "next_text" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - outline { - x: 1.0 - y: 1.0 - z: 1.0 - w: 1.0 - } - shadow { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - adjust_mode: ADJUST_MODE_FIT - line_break: false - parent: "next" - 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 -} -nodes { - position { - x: 300.0 - y: 400.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: "gui/empty" - id: "center" - 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: 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: "gui/empty" - id: "buttons" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "center" - 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: 254.0 - z: 0.0 - w: 1.0 - } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - scale { - x: 0.5 - y: 0.5 - z: 1.0 - w: 1.0 - } - size { - x: 426.0 - y: 190.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: "gui/green_long" - id: "button_1" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "buttons" - 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: 20.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: "Button 1" - font: "game" - id: "text_1" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - outline { - x: 1.0 - y: 1.0 - z: 1.0 - w: 1.0 - } - shadow { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - adjust_mode: ADJUST_MODE_FIT - line_break: false - parent: "button_1" - 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 -} -nodes { - position { - x: 0.0 - y: 129.0 - z: 0.0 - w: 1.0 - } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - scale { - x: 0.5 - y: 0.5 - z: 1.0 - w: 1.0 - } - size { - x: 426.0 - y: 190.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: "gui/green_long" - id: "button_2" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "buttons" - 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: 20.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: "Button 2" - font: "game" - id: "text_2" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - outline { - x: 1.0 - y: 1.0 - z: 1.0 - w: 1.0 - } - shadow { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - adjust_mode: ADJUST_MODE_FIT - line_break: false - parent: "button_2" - 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 -} -nodes { - position { - x: 600.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: "gui/empty" - id: "progress" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "center" - 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: 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: 391.0 - y: 40.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: "gui/progress_back" - id: "simple_back" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "progress" - 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: -194.5 - y: 2.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: 389.0 - y: 35.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: "gui/progress_yellow" - id: "simple_fill" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_W - adjust_mode: ADJUST_MODE_FIT - parent: "simple_back" - layer: "" - inherit_alpha: true - slice9 { - x: 15.0 - y: 0.0 - z: 15.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: 106.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: 391.0 - y: 40.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: "gui/progress_back" - id: "simple_vert" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "progress" - 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: -17.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: 389.0 - y: 35.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: "gui/progress_yellow" - id: "simple_vert_fill" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_S - adjust_mode: ADJUST_MODE_FIT - parent: "simple_vert" - layer: "" - inherit_alpha: true - slice9 { - x: 15.0 - y: 0.0 - z: 15.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: -130.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: 391.0 - y: 40.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: "gui/progress_back" - id: "rich_back" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "progress" - 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: -194.5 - y: 2.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: 389.0 - y: 35.0 - z: 0.0 - w: 1.0 - } - color { - x: 0.6 - y: 0.6 - z: 0.6 - w: 1.0 - } - type: TYPE_BOX - blend_mode: BLEND_MODE_ALPHA - texture: "gui/progress_green" - id: "rich_green" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_W - adjust_mode: ADJUST_MODE_FIT - parent: "rich_back" - layer: "" - inherit_alpha: true - slice9 { - x: 15.0 - y: 0.0 - z: 15.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: -194.5 - y: 2.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: 389.0 - y: 35.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: "gui/progress_red" - id: "rich_red" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_W - adjust_mode: ADJUST_MODE_FIT - parent: "rich_back" - layer: "" - inherit_alpha: true - slice9 { - x: 15.0 - y: 0.0 - z: 15.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: -194.5 - y: 2.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: 389.0 - y: 35.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: "gui/progress_yellow" - id: "rich_fill" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_W - adjust_mode: ADJUST_MODE_FIT - parent: "rich_back" - layer: "" - inherit_alpha: true - slice9 { - x: 15.0 - y: 0.0 - z: 15.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: 110.0 - y: 250.0 - z: 0.0 - w: 1.0 - } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - scale { - x: 0.5 - y: 0.5 - z: 1.0 - w: 1.0 - } - size { - x: 426.0 - y: 190.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: "gui/green_long" - id: "rich_add" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "progress" - 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: 20.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: "add rich" - font: "game" - id: "rich_add_text" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - outline { - x: 1.0 - y: 1.0 - z: 1.0 - w: 1.0 - } - shadow { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - adjust_mode: ADJUST_MODE_FIT - line_break: false - parent: "rich_add" - 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 -} -nodes { - position { - x: -110.0 - y: 250.0 - z: 0.0 - w: 1.0 - } - rotation { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - scale { - x: 0.5 - y: 0.5 - z: 1.0 - w: 1.0 - } - size { - x: 426.0 - y: 190.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: "gui/green_long" - id: "rich_dec" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "progress" - 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: 20.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: "dec rich\n" - "" - font: "game" - id: "rich_dec_text" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - outline { - x: 1.0 - y: 1.0 - z: 1.0 - w: 1.0 - } - shadow { - x: 0.0 - y: 0.0 - z: 0.0 - w: 1.0 - } - adjust_mode: ADJUST_MODE_FIT - line_break: false - parent: "rich_dec" - 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 -} -nodes { - position { - x: 1200.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: "gui/empty" - id: "grids" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "center" - 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: 5.0 - y: -591.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: 80.0 - y: 80.0 - z: 0.0 - w: 1.0 - } - color { - x: 0.0 - y: 0.0 - z: 1.0 - w: 1.0 - } - type: TYPE_BOX - blend_mode: BLEND_MODE_ALPHA - texture: "" - id: "prefab" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "grids" - 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: -291.0 - y: 292.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: "gui/empty" - id: "grid_1" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "grids" - 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: 167.0 - y: 97.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: "gui/empty" - id: "grid_2" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "grids" - 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: -277.0 - y: -216.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: "gui/empty" - id: "grid_3" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "grids" - 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 -} -material: "/builtins/materials/gui.material" -adjust_reference: ADJUST_REFERENCE_PARENT -max_nodes: 512 diff --git a/example/example.gui.gui_script b/example/example.gui.gui_script deleted file mode 100644 index bbd8be7..0000000 --- a/example/example.gui.gui_script +++ /dev/null @@ -1,155 +0,0 @@ -local druid = require("druid.druid") -local druid_settings = require("druid.system.settings") - -local lang = { - locale_text = "Localized" -} -local start_x = 300 -local page_width = 600 -local cur_page = 1 -local max_page = 3 - - - -local function log(self, params) - print(params) -end - - -local function setup_druid(self) - -- two different way of exernal component regesstration - druid.comps["my_mega_test_comp"] = require "druid.base.text" - druid.register("my_custom_component", {}) - - druid_settings.is_debug = true - druid_settings.play_sound = function(name) - sound.play("sounds#" .. name) - end - druid_settings.get_text = function(text_id) - return lang[text_id] - end -end - - -local function change_page(self, delta) - cur_page = cur_page + delta - cur_page = math.max(1, cur_page) - cur_page = math.min(cur_page, max_page) - - gui.animate(gui.get_node("center"), "position.x", - start_x - (page_width * (cur_page - 1)), gui.EASING_OUTSINE, 0.1) -end - -local function init_pages(self) - self.druid:new_button("prev", change_page, -1) - self.druid:new_button("next", change_page, 1) -end - - -local function init_buttons(self) - self.druid:new_button("button_1", log, "button 1") - - self.druid:new(druid.comps.button, "button_2", log, "button 2") -end - - -local function init_progress(self) - local val = 0.4 - local simple = self.druid:new_progress("simple_fill", "x", val) - local vert = self.druid:new_progress("simple_vert_fill", "y", val) - - simple:set_steps({0, 0.3, 0.6, 1}, function(_, step) - print("STEP:", step) - end) - - timer.delay(0.4, true, function() - val = val + 0.1 - if val > 1 then - simple:empty() - vert:empty() - val = 0 - end - simple:to(val) - vert:to(val) - end) - - local rich = self.druid:new_progress_rich("rich_fill", "rich_red", "rich_green", "x") - - rich:set_to(0.3) - - local rich_val = 0.3 - self.druid:new_button("rich_add", function() - rich_val = rich_val + 0.1 - rich:to(rich_val) - end) - self.druid:new_button("rich_dec", function() - rich_val = rich_val - 0.1 - rich:to(rich_val) - end) -end - - -local function init_grid(self) - local prefab = gui.get_node("prefab") - - -- 4 items per row - local grid = self.druid:new_grid("grid_1", prefab, 4) - grid:set_anchor(vmath.vector3(0)) - grid:set_offset(vmath.vector3(2, 2, 0)) - for i = 1, 16 do - local node = gui.clone(prefab) - grid:add(node) - end - - local val = 0 - timer.delay(0.1, true, function() - val = val + 0.5 - grid:set_offset(vmath.vector3(val)) - if val > 4 then - val = 0 - end - end) - - - -- 1 item per row - local grid2 = self.druid:new_grid("grid_2", prefab, 1) - grid2:set_offset(vmath.vector3(0, 10, 0)) - for i = 1, 4 do - local node = gui.clone(prefab) - grid2:add(node) - end - - - local grid3 = self.druid:new_grid("grid_3", prefab, 10) - grid3:set_anchor(vmath.vector3(0)) - grid3:set_offset(vmath.vector3(5, 0, 0)) - for i = 1, 4 do - local node = gui.clone(prefab) - grid3:add(node) - end -end - - -function init(self) - setup_druid(self) - self.druid = druid.new(self) - - init_pages(self) - init_buttons(self) - init_progress(self) - init_grid(self) - - self.druid:new_android_back(log, "some") -end - -function update(self, dt) - self.druid:update(dt) -end - -function on_message(self, message_id, message, sender) - self.druid:on_message(message_id, message, sender) -end - -function on_input(self, action_id, action) - self.druid:on_input(action_id, action) -end \ No newline at end of file diff --git a/example/game.font b/example/game.font deleted file mode 100644 index 2b014d6..0000000 --- a/example/game.font +++ /dev/null @@ -1,17 +0,0 @@ -font: "/example/res/exo2.ttf" -material: "/builtins/fonts/font.material" -size: 64 -antialias: 1 -alpha: 1.0 -outline_alpha: 0.0 -outline_width: 0.0 -shadow_alpha: 1.0 -shadow_blur: 0 -shadow_x: 3.0 -shadow_y: -5.0 -extra_characters: "" -output_format: TYPE_BITMAP -all_chars: false -cache_width: 0 -cache_height: 0 -render_mode: MODE_MULTI_LAYER diff --git a/example/gui.atlas b/example/gui.atlas deleted file mode 100644 index 6cb5a3a..0000000 --- a/example/gui.atlas +++ /dev/null @@ -1,24 +0,0 @@ -images { - image: "/example/res/gray_long.png" -} -images { - image: "/example/res/green_long.png" -} -images { - image: "/example/res/progress_back.png" -} -images { - image: "/example/res/progress_green.png" -} -images { - image: "/example/res/progress_red.png" -} -images { - image: "/example/res/progress_yellow.png" -} -images { - image: "/example/res/empty.png" -} -margin: 2 -extrude_borders: 2 -inner_padding: 0 diff --git a/example/kenney/gui/main/main.gui b/example/gui/main/main.gui similarity index 98% rename from example/kenney/gui/main/main.gui rename to example/gui/main/main.gui index e1b5f7a..4e3a5ec 100644 --- a/example/kenney/gui/main/main.gui +++ b/example/gui/main/main.gui @@ -1,11 +1,11 @@ -script: "/example/kenney/gui/main/main.gui_script" +script: "/example/gui/main/main.gui_script" fonts { name: "game" - font: "/example/kenney/assets/fonts/game.font" + font: "/example/assets/fonts/game.font" } textures { name: "kenney" - texture: "/example/kenney/assets/images/kenney.atlas" + texture: "/example/assets/images/kenney.atlas" } background_color { x: 0.0 @@ -387,7 +387,7 @@ nodes { layer: "" inherit_alpha: true alpha: 1.0 - template: "/example/kenney/templates/button.gui" + template: "/example/templates/button.gui" template_node_child: false } nodes { @@ -1843,7 +1843,7 @@ nodes { layer: "" inherit_alpha: true alpha: 1.0 - template: "/example/kenney/templates/radio.gui" + template: "/example/templates/radio.gui" template_node_child: false } nodes { @@ -1993,7 +1993,7 @@ nodes { layer: "" inherit_alpha: true alpha: 1.0 - template: "/example/kenney/templates/radio.gui" + template: "/example/templates/radio.gui" template_node_child: false } nodes { @@ -2143,7 +2143,7 @@ nodes { layer: "" inherit_alpha: true alpha: 1.0 - template: "/example/kenney/templates/radio.gui" + template: "/example/templates/radio.gui" template_node_child: false } nodes { @@ -2466,7 +2466,7 @@ nodes { layer: "" inherit_alpha: true alpha: 1.0 - template: "/example/kenney/templates/checkbox.gui" + template: "/example/templates/checkbox.gui" template_node_child: false } nodes { @@ -2616,7 +2616,7 @@ nodes { layer: "" inherit_alpha: true alpha: 1.0 - template: "/example/kenney/templates/checkbox.gui" + template: "/example/templates/checkbox.gui" template_node_child: false } nodes { @@ -2766,7 +2766,7 @@ nodes { layer: "" inherit_alpha: true alpha: 1.0 - template: "/example/kenney/templates/checkbox.gui" + template: "/example/templates/checkbox.gui" template_node_child: false } nodes { @@ -4128,7 +4128,7 @@ nodes { layer: "" inherit_alpha: true alpha: 1.0 - template: "/example/kenney/templates/button.gui" + template: "/example/templates/button.gui" template_node_child: false } nodes { @@ -4287,7 +4287,7 @@ nodes { layer: "" inherit_alpha: true alpha: 1.0 - template: "/example/kenney/templates/button.gui" + template: "/example/templates/button.gui" template_node_child: false } nodes { @@ -4447,7 +4447,7 @@ nodes { layer: "" inherit_alpha: true alpha: 1.0 - template: "/example/kenney/templates/button.gui" + template: "/example/templates/button.gui" template_node_child: false } nodes { @@ -4607,7 +4607,7 @@ nodes { layer: "" inherit_alpha: true alpha: 1.0 - template: "/example/kenney/templates/button.gui" + template: "/example/templates/button.gui" template_node_child: false } nodes { @@ -4767,7 +4767,7 @@ nodes { layer: "" inherit_alpha: true alpha: 1.0 - template: "/example/kenney/templates/button.gui" + template: "/example/templates/button.gui" template_node_child: false } nodes { @@ -4927,7 +4927,7 @@ nodes { layer: "" inherit_alpha: true alpha: 1.0 - template: "/example/kenney/templates/button.gui" + template: "/example/templates/button.gui" template_node_child: false } nodes { @@ -6062,7 +6062,7 @@ nodes { layer: "" inherit_alpha: true alpha: 1.0 - template: "/example/kenney/templates/button.gui" + template: "/example/templates/button.gui" template_node_child: false } nodes { @@ -6221,7 +6221,7 @@ nodes { layer: "" inherit_alpha: true alpha: 1.0 - template: "/example/kenney/templates/button.gui" + template: "/example/templates/button.gui" template_node_child: false } nodes { diff --git a/example/kenney/gui/main/main.gui_script b/example/gui/main/main.gui_script similarity index 85% rename from example/kenney/gui/main/main.gui_script rename to example/gui/main/main.gui_script index 627cbc7..26f3d8a 100644 --- a/example/kenney/gui/main/main.gui_script +++ b/example/gui/main/main.gui_script @@ -3,10 +3,10 @@ local druid = require("druid.druid") local empty_style = require("druid.styles.empty.style") local default_style = require("druid.styles.default.style") -local main_page = require("example.kenney.page.main") -local text_page = require("example.kenney.page.texts") -local button_page = require("example.kenney.page.button") -local scroll_page = require("example.kenney.page.scroll") +local main_page = require("example.page.main") +local text_page = require("example.page.texts") +local button_page = require("example.page.button") +local scroll_page = require("example.page.scroll") local pages = { "main_page", diff --git a/example/kenney/init.script b/example/init.script similarity index 92% rename from example/kenney/init.script rename to example/init.script index aa2bf5c..87e6385 100644 --- a/example/kenney/init.script +++ b/example/init.script @@ -1,6 +1,6 @@ local druid = require("druid.druid") local const = require("druid.const") -local lang = require("example.kenney.lang") +local lang = require("example.lang") local function setup_druid() diff --git a/example/kenney/kenney.collection b/example/kenney.collection similarity index 89% rename from example/kenney/kenney.collection rename to example/kenney.collection index 3f630ff..a8b3693 100644 --- a/example/kenney/kenney.collection +++ b/example/kenney.collection @@ -4,7 +4,7 @@ embedded_instances { id: "gui" data: "components {\n" " id: \"main\"\n" - " component: \"/example/kenney/gui/main/main.gui\"\n" + " component: \"/example/gui/main/main.gui\"\n" " position {\n" " x: 0.0\n" " y: 0.0\n" @@ -39,7 +39,7 @@ embedded_instances { id: "system" data: "components {\n" " id: \"init\"\n" - " component: \"/example/kenney/init.script\"\n" + " component: \"/example/init.script\"\n" " position {\n" " x: 0.0\n" " y: 0.0\n" @@ -75,7 +75,7 @@ embedded_instances { data: "embedded_components {\n" " id: \"click\"\n" " type: \"sound\"\n" - " data: \"sound: \\\"/example/kenney/assets/sounds/click.ogg\\\"\\n" + " data: \"sound: \\\"/example/assets/sounds/click.ogg\\\"\\n" "looping: 0\\n" "group: \\\"master\\\"\\n" "gain: 1.0\\n" diff --git a/example/kenney/assets/images/kenney.atlas b/example/kenney/assets/images/kenney.atlas deleted file mode 100644 index f2df027..0000000 --- a/example/kenney/assets/images/kenney.atlas +++ /dev/null @@ -1,60 +0,0 @@ -images { - image: "/example/kenney/assets/images/back/back_blue.png" -} -images { - image: "/example/kenney/assets/images/back/back_gray.png" -} -images { - image: "/example/kenney/assets/images/back/back_green.png" -} -images { - image: "/example/kenney/assets/images/back/back_red.png" -} -images { - image: "/example/kenney/assets/images/buttons/button_green.png" -} -images { - image: "/example/kenney/assets/images/buttons/button_red.png" -} -images { - image: "/example/kenney/assets/images/buttons/button_yellow.png" -} -images { - image: "/example/kenney/assets/images/empty.png" -} -images { - image: "/example/kenney/assets/images/progress/progress_back.png" -} -images { - image: "/example/kenney/assets/images/progress/progress_fill_green.png" -} -images { - image: "/example/kenney/assets/images/progress/progress_fill_red.png" -} -images { - image: "/example/kenney/assets/images/progress/progress_fill_yellow.png" -} -images { - image: "/example/kenney/assets/images/radio/check_back_circle.png" -} -images { - image: "/example/kenney/assets/images/radio/check_back_square.png" -} -images { - image: "/example/kenney/assets/images/radio/checkmark.png" -} -images { - image: "/example/kenney/assets/images/radio/tick.png" -} -images { - image: "/example/kenney/assets/images/slider/slider_back.png" -} -images { - image: "/example/kenney/assets/images/slider/slider_move.png" -} -images { - image: "/example/kenney/assets/images/buttons/button_blue.png" -} -margin: 0 -extrude_borders: 2 -inner_padding: 0 diff --git a/example/kenney/lang.lua b/example/lang.lua similarity index 100% rename from example/kenney/lang.lua rename to example/lang.lua diff --git a/example/kenney/page/button.lua b/example/page/button.lua similarity index 100% rename from example/kenney/page/button.lua rename to example/page/button.lua diff --git a/example/kenney/page/main.lua b/example/page/main.lua similarity index 98% rename from example/kenney/page/main.lua rename to example/page/main.lua index 834593c..5702deb 100644 --- a/example/kenney/page/main.lua +++ b/example/page/main.lua @@ -1,4 +1,4 @@ -local lang = require("example.kenney.lang") +local lang = require("example.lang") local M = {} diff --git a/example/kenney/page/scroll.lua b/example/page/scroll.lua similarity index 89% rename from example/kenney/page/scroll.lua rename to example/page/scroll.lua index 4fb112c..6557082 100644 --- a/example/kenney/page/scroll.lua +++ b/example/page/scroll.lua @@ -14,11 +14,12 @@ local function init_grid(self) grid:add(clone_prefab["grid_prefab"]) gui.set_text(clone_prefab["grid_prefab_text"], "Node " .. i) - self.druid:new_button(clone_prefab["grid_button"], function() + local button = self.druid:new_button(clone_prefab["grid_button"], function() local position = gui.get_position(clone_prefab["grid_prefab"]) position.x = -position.x grid_scroll:scroll_to(position) end) + button:set_click_zone(gui.get_node("scroll_with_grid_size")) end gui.set_enabled(prefab, false) diff --git a/example/kenney/page/texts.lua b/example/page/texts.lua similarity index 96% rename from example/kenney/page/texts.lua rename to example/page/texts.lua index d1d459d..0a91534 100644 --- a/example/kenney/page/texts.lua +++ b/example/page/texts.lua @@ -1,5 +1,3 @@ -local lang = require("example.kenney.lang") - local M = {} local pivots = { diff --git a/example/res/click.ogg b/example/res/click.ogg deleted file mode 100755 index 5d223f3..0000000 Binary files a/example/res/click.ogg and /dev/null differ diff --git a/example/res/custom.texture_profiles b/example/res/custom.texture_profiles deleted file mode 100644 index 5b0d776..0000000 --- a/example/res/custom.texture_profiles +++ /dev/null @@ -1,18 +0,0 @@ -path_settings { - path: "**" - profile: "Default" -} -profiles { - name: "Default" - platforms { - os: OS_ID_GENERIC - formats { - format: TEXTURE_FORMAT_RGBA - compression_level: BEST - compression_type: COMPRESSION_TYPE_DEFAULT - } - mipmaps: false - max_texture_size: 0 - premultiply_alpha: true - } -} diff --git a/example/res/empty.png b/example/res/empty.png deleted file mode 100755 index 5da9ec0..0000000 Binary files a/example/res/empty.png and /dev/null differ diff --git a/example/res/exo2.ttf b/example/res/exo2.ttf deleted file mode 100755 index 49f0b49..0000000 Binary files a/example/res/exo2.ttf and /dev/null differ diff --git a/example/res/gray_long.png b/example/res/gray_long.png deleted file mode 100644 index cc29967..0000000 Binary files a/example/res/gray_long.png and /dev/null differ diff --git a/example/res/green_long.png b/example/res/green_long.png deleted file mode 100644 index 92e1420..0000000 Binary files a/example/res/green_long.png and /dev/null differ diff --git a/example/res/progress_back.png b/example/res/progress_back.png deleted file mode 100755 index 30a6652..0000000 Binary files a/example/res/progress_back.png and /dev/null differ diff --git a/example/res/progress_green.png b/example/res/progress_green.png deleted file mode 100755 index 93907f5..0000000 Binary files a/example/res/progress_green.png and /dev/null differ diff --git a/example/res/progress_red.png b/example/res/progress_red.png deleted file mode 100755 index 4f55b3a..0000000 Binary files a/example/res/progress_red.png and /dev/null differ diff --git a/example/res/progress_yellow.png b/example/res/progress_yellow.png deleted file mode 100755 index 3e4e38d..0000000 Binary files a/example/res/progress_yellow.png and /dev/null differ diff --git a/example/scroll.collection b/example/scroll.collection deleted file mode 100644 index c54a758..0000000 --- a/example/scroll.collection +++ /dev/null @@ -1,37 +0,0 @@ -name: "default" -scale_along_z: 0 -embedded_instances { - id: "scroll" - data: "components {\n" - " id: \"scroll\"\n" - " component: \"/example/scroll/scroll.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 - } -} diff --git a/example/scroll/scroll.gui b/example/scroll/scroll.gui deleted file mode 100644 index c9fab11..0000000 --- a/example/scroll/scroll.gui +++ /dev/null @@ -1,821 +0,0 @@ -script: "/example/scroll/scroll.gui_script" -fonts { - name: "game" - font: "/example/game.font" -} -textures { - name: "gui" - texture: "/example/gui.atlas" -} -background_color { - x: 0.0 - y: 0.0 - z: 0.0 - w: 0.0 -} -nodes { - position { - x: 300.0 - y: 450.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: 600.0 - y: 900.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: "gui/empty" - id: "input_zone" - 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 -} -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: "gui/empty" - id: "parent" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_STRETCH - parent: "input_zone" - 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: 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: "gui/empty" - id: "main_page" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "parent" - 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: 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: "Main scroll page" - font: "game" - id: "main_text" - 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: "main_page" - 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: -600.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: "gui/empty" - id: "left_page" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_STRETCH - parent: "parent" - 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: 330.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: "Left text\n" - "" - font: "game" - id: "left_text" - 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: "left_page" - 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: 554.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: 400.0 - y: 80.0 - z: 0.0 - w: 1.0 - } - color { - x: 0.0 - y: 0.0 - z: 1.0 - w: 1.0 - } - type: TYPE_BOX - blend_mode: BLEND_MODE_ALPHA - texture: "" - id: "prefab" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_FIT - parent: "left_page" - 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: 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: 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: "1" - font: "game" - id: "number" - 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: "prefab" - 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: -150.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: 600.0 - y: 600.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: "page_input" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_STRETCH - parent: "left_page" - 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.3 - template_node_child: false - size_mode: SIZE_MODE_MANUAL -} -nodes { - position { - x: 0.0 - y: 300.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: 600.0 - y: 600.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: "gui/empty" - id: "page_parent" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_N - adjust_mode: ADJUST_MODE_STRETCH - parent: "page_input" - 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: 600.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: "gui/empty" - id: "right_page" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_CENTER - adjust_mode: ADJUST_MODE_STRETCH - parent: "parent" - 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: 330.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: "Right text\n" - "" - font: "game" - id: "right_text" - 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: "right_page" - 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: 150.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: 600.0 - y: 600.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: "right_input" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_N - adjust_mode: ADJUST_MODE_STRETCH - parent: "right_page" - 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.3 - 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: 600.0 - y: 600.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: "gui/empty" - id: "right_parent" - xanchor: XANCHOR_NONE - yanchor: YANCHOR_NONE - pivot: PIVOT_N - adjust_mode: ADJUST_MODE_STRETCH - parent: "right_input" - 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 -} -material: "/builtins/materials/gui.material" -adjust_reference: ADJUST_REFERENCE_PARENT -max_nodes: 512 diff --git a/example/scroll/scroll.gui_script b/example/scroll/scroll.gui_script deleted file mode 100644 index 259b9be..0000000 --- a/example/scroll/scroll.gui_script +++ /dev/null @@ -1,84 +0,0 @@ -local druid = require("druid.druid") - - -local function init_left_page(self) - local prefab = gui.get_node("prefab") - self.left_grid = self.druid:new_grid("page_parent", prefab, 1) - self.left_grid:set_offset(vmath.vector3(0, 5, 0)) - - for i = 1, 7 do - local nodes = gui.clone_tree(prefab) - gui.set_text(nodes["number"], i) - self.left_grid:add(nodes["prefab"]) - end - - local size = self.left_grid:get_size() - local view_size = gui.get_size(gui.get_node("page_parent")) - - self.left_scroll = self.druid:new_scroll("page_parent", "page_input", - vmath.vector4(0, view_size.y/2, 0, -size.y - view_size.y/2)) - - self.left_scroll:set_points(self.left_grid:get_all_pos()) -end - - -local function log(self, index) - print("Click on", index) -end - - -local function init_right_page(self) - local prefab = gui.get_node("prefab") - self.right_grid = self.druid:new_grid("right_parent", prefab, 1) - self.right_grid:set_offset(vmath.vector3(0, 5, 0)) - - for i = 1, 20 do - local nodes = gui.clone_tree(prefab) - gui.set_text(nodes["number"], i) - self.druid:new_button(nodes["prefab"], log, i) - self.right_grid:add(nodes["prefab"]) - end - - local size = self.right_grid:get_size() - local view_size = gui.get_size(gui.get_node("right_parent")) - - -- TODO: Should we calc scrolle size with parent size? - -- If yes, we will pass only content size to correct scrolling - self.right_scroll = self.druid:new_scroll("right_parent", "right_input", - vmath.vector4(0, 0, 0, -size.y - view_size.y)) - - self.right_scroll:set_points(self.right_grid:get_all_pos()) - - self.right_scroll:on_point_move(function(self, index, pos) - print("Point to element:", index) - end) -end - - -function init(self) - self.druid = druid.new(self) - - -- -600 to 600 - left and right pos.x pages - -- border is vmath.vector4(left_x, top_y, right_x, bot_y) - self.main_scroll = self.druid:new_scroll("parent", "input_zone", - vmath.vector4(-600, 0, 600, 0)) - - self.main_scroll:set_points({ - vmath.vector3(600, 0, 0), - vmath.vector3(0, 0, 0), - vmath.vector3(-600, 0, 0), - }) - -- Disable free inert and we only scroll via points, if exist - self.main_scroll:set_inert(false) - - init_left_page(self) - init_right_page(self) -end - -function update(self, dt) - self.druid:update(dt) -end - -function on_input(self, action_id, action) - self.druid:on_input(action_id, action) -end diff --git a/example/kenney/templates/button.gui b/example/templates/button.gui similarity index 94% rename from example/kenney/templates/button.gui rename to example/templates/button.gui index 4beda9c..0e17ab9 100644 --- a/example/kenney/templates/button.gui +++ b/example/templates/button.gui @@ -1,11 +1,11 @@ script: "" fonts { name: "game" - font: "/example/kenney/assets/fonts/game.font" + font: "/example/assets/fonts/game.font" } textures { name: "kenney" - texture: "/example/kenney/assets/images/kenney.atlas" + texture: "/example/assets/images/kenney.atlas" } background_color { x: 0.0 diff --git a/example/kenney/templates/checkbox.gui b/example/templates/checkbox.gui similarity index 96% rename from example/kenney/templates/checkbox.gui rename to example/templates/checkbox.gui index 393adbe..53c2069 100644 --- a/example/kenney/templates/checkbox.gui +++ b/example/templates/checkbox.gui @@ -1,7 +1,7 @@ script: "" textures { name: "kenney" - texture: "/example/kenney/assets/images/kenney.atlas" + texture: "/example/assets/images/kenney.atlas" } background_color { x: 0.0 diff --git a/example/kenney/templates/radio.gui b/example/templates/radio.gui similarity index 96% rename from example/kenney/templates/radio.gui rename to example/templates/radio.gui index eef5fa2..75ed7d1 100644 --- a/example/kenney/templates/radio.gui +++ b/example/templates/radio.gui @@ -1,7 +1,7 @@ script: "" textures { name: "kenney" - texture: "/example/kenney/assets/images/kenney.atlas" + texture: "/example/assets/images/kenney.atlas" } background_color { x: 0.0 diff --git a/game.project b/game.project index 2a618f5..f9d7075 100644 --- a/game.project +++ b/game.project @@ -1,5 +1,5 @@ [bootstrap] -main_collection = /example/kenney/kenney.collectionc +main_collection = /example/kenney.collectionc [script] shared_state = 1 @@ -14,11 +14,9 @@ title = druid [library] include_dirs = druid -[graphics] -texture_profiles = /example/res/custom.texture_profiles - [input] gamepads = /builtins/input/default.gamepadsc [druid] -autofocus = 1 \ No newline at end of file +autofocus = 1 +