mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 10:02:18 +02:00
Update with container examples
This commit is contained in:
@@ -0,0 +1,308 @@
|
||||
fonts {
|
||||
name: "text_bold"
|
||||
font: "/example/assets/fonts/text_bold.font"
|
||||
}
|
||||
fonts {
|
||||
name: "text_regular"
|
||||
font: "/example/assets/fonts/text_regular.font"
|
||||
}
|
||||
textures {
|
||||
name: "druid_example"
|
||||
texture: "/example/assets/druid_example.atlas"
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 1000.0
|
||||
y: 1000.0
|
||||
}
|
||||
color {
|
||||
x: 0.173
|
||||
y: 0.184
|
||||
z: 0.204
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_64"
|
||||
id: "root"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
z: 32.0
|
||||
w: 32.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: 455.0
|
||||
}
|
||||
size {
|
||||
x: 900.0
|
||||
y: 100.0
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
text: "Can be used as relative anchors"
|
||||
font: "text_bold"
|
||||
id: "text"
|
||||
parent: "root"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 840.0
|
||||
y: 840.0
|
||||
}
|
||||
color {
|
||||
x: 0.129
|
||||
y: 0.141
|
||||
z: 0.157
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "parent_container"
|
||||
parent: "root"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 400.0
|
||||
y: 400.0
|
||||
}
|
||||
size {
|
||||
x: 96.0
|
||||
y: 96.0
|
||||
}
|
||||
color {
|
||||
x: 0.902
|
||||
y: 0.875
|
||||
z: 0.624
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_ne"
|
||||
pivot: PIVOT_NE
|
||||
parent: "parent_container"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 400.0
|
||||
}
|
||||
size {
|
||||
x: 96.0
|
||||
y: 96.0
|
||||
}
|
||||
color {
|
||||
x: 0.902
|
||||
y: 0.875
|
||||
z: 0.624
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_e"
|
||||
pivot: PIVOT_E
|
||||
parent: "parent_container"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: 400.0
|
||||
}
|
||||
size {
|
||||
x: 96.0
|
||||
y: 96.0
|
||||
}
|
||||
color {
|
||||
x: 0.902
|
||||
y: 0.875
|
||||
z: 0.624
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_n"
|
||||
pivot: PIVOT_N
|
||||
parent: "parent_container"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 400.0
|
||||
y: -400.0
|
||||
}
|
||||
size {
|
||||
x: 96.0
|
||||
y: 96.0
|
||||
}
|
||||
color {
|
||||
x: 0.902
|
||||
y: 0.875
|
||||
z: 0.624
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_se"
|
||||
pivot: PIVOT_SE
|
||||
parent: "parent_container"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: -400.0
|
||||
}
|
||||
size {
|
||||
x: 96.0
|
||||
y: 96.0
|
||||
}
|
||||
color {
|
||||
x: 0.902
|
||||
y: 0.875
|
||||
z: 0.624
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_s"
|
||||
pivot: PIVOT_S
|
||||
parent: "parent_container"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -400.0
|
||||
y: -400.0
|
||||
}
|
||||
size {
|
||||
x: 96.0
|
||||
y: 96.0
|
||||
}
|
||||
color {
|
||||
x: 0.902
|
||||
y: 0.875
|
||||
z: 0.624
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_sw"
|
||||
pivot: PIVOT_SW
|
||||
parent: "parent_container"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -400.0
|
||||
}
|
||||
size {
|
||||
x: 96.0
|
||||
y: 96.0
|
||||
}
|
||||
color {
|
||||
x: 0.902
|
||||
y: 0.875
|
||||
z: 0.624
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_w"
|
||||
pivot: PIVOT_W
|
||||
parent: "parent_container"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -400.0
|
||||
y: 400.0
|
||||
}
|
||||
size {
|
||||
x: 96.0
|
||||
y: 96.0
|
||||
}
|
||||
color {
|
||||
x: 0.902
|
||||
y: 0.875
|
||||
z: 0.624
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_nw"
|
||||
pivot: PIVOT_NW
|
||||
parent: "parent_container"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 96.0
|
||||
y: 96.0
|
||||
}
|
||||
color {
|
||||
x: 0.902
|
||||
y: 0.875
|
||||
z: 0.624
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_center"
|
||||
parent: "parent_container"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
@@ -0,0 +1,21 @@
|
||||
---@class widget.container_anchors: druid.widget
|
||||
local M = {}
|
||||
|
||||
|
||||
function M:init()
|
||||
self.parent_container = self.druid:new_container("parent_container")
|
||||
self.parent_container:create_draggable_corners()
|
||||
|
||||
self.parent_container:add_container("anchor_ne")
|
||||
self.parent_container:add_container("anchor_nw")
|
||||
self.parent_container:add_container("anchor_se")
|
||||
self.parent_container:add_container("anchor_sw")
|
||||
self.parent_container:add_container("anchor_n")
|
||||
self.parent_container:add_container("anchor_s")
|
||||
self.parent_container:add_container("anchor_e")
|
||||
self.parent_container:add_container("anchor_w")
|
||||
self.parent_container:add_container("anchor_center")
|
||||
end
|
||||
|
||||
|
||||
return M
|
416
example/examples/container/container_resize/container_resize.gui
Normal file
416
example/examples/container/container_resize/container_resize.gui
Normal file
@@ -0,0 +1,416 @@
|
||||
fonts {
|
||||
name: "text_bold"
|
||||
font: "/example/assets/fonts/text_bold.font"
|
||||
}
|
||||
fonts {
|
||||
name: "text_regular"
|
||||
font: "/example/assets/fonts/text_regular.font"
|
||||
}
|
||||
textures {
|
||||
name: "druid_example"
|
||||
texture: "/example/assets/druid_example.atlas"
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 1000.0
|
||||
y: 1000.0
|
||||
}
|
||||
color {
|
||||
x: 0.173
|
||||
y: 0.184
|
||||
z: 0.204
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_64"
|
||||
id: "root"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
z: 32.0
|
||||
w: 32.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: 455.0
|
||||
}
|
||||
size {
|
||||
x: 900.0
|
||||
y: 100.0
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
text: "Can be used as relative anchors"
|
||||
font: "text_bold"
|
||||
id: "text"
|
||||
parent: "root"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 800.0
|
||||
y: 800.0
|
||||
}
|
||||
color {
|
||||
x: 0.129
|
||||
y: 0.141
|
||||
z: 0.157
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "parent_container"
|
||||
parent: "root"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -400.0
|
||||
}
|
||||
size {
|
||||
x: 200.0
|
||||
y: 800.0
|
||||
}
|
||||
color {
|
||||
x: 0.902
|
||||
y: 0.875
|
||||
z: 0.624
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "panel_left"
|
||||
pivot: PIVOT_W
|
||||
parent: "parent_container"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 400.0
|
||||
}
|
||||
size {
|
||||
x: 200.0
|
||||
y: 800.0
|
||||
}
|
||||
color {
|
||||
x: 0.957
|
||||
y: 0.608
|
||||
z: 0.608
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "panel_right"
|
||||
pivot: PIVOT_E
|
||||
parent: "parent_container"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: -400.0
|
||||
}
|
||||
size {
|
||||
x: 400.0
|
||||
y: 200.0
|
||||
}
|
||||
color {
|
||||
x: 0.631
|
||||
y: 0.843
|
||||
z: 0.961
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "panel_bot"
|
||||
xanchor: XANCHOR_LEFT
|
||||
pivot: PIVOT_S
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
parent: "parent_container"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: 100.0
|
||||
}
|
||||
size {
|
||||
x: 400.0
|
||||
y: 600.0
|
||||
}
|
||||
color {
|
||||
x: 0.557
|
||||
y: 0.835
|
||||
z: 0.62
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "panel_content"
|
||||
xanchor: XANCHOR_LEFT
|
||||
yanchor: YANCHOR_BOTTOM
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
parent: "parent_container"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 200.0
|
||||
y: 300.0
|
||||
}
|
||||
size {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
}
|
||||
color {
|
||||
x: 0.129
|
||||
y: 0.141
|
||||
z: 0.157
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_ne"
|
||||
pivot: PIVOT_NE
|
||||
parent: "panel_content"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: -300.0
|
||||
}
|
||||
size {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
}
|
||||
color {
|
||||
x: 0.129
|
||||
y: 0.141
|
||||
z: 0.157
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_s"
|
||||
pivot: PIVOT_S
|
||||
parent: "panel_content"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -200.0
|
||||
y: -300.0
|
||||
}
|
||||
size {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
}
|
||||
color {
|
||||
x: 0.129
|
||||
y: 0.141
|
||||
z: 0.157
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_sw"
|
||||
pivot: PIVOT_SW
|
||||
parent: "panel_content"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
}
|
||||
color {
|
||||
x: 0.129
|
||||
y: 0.141
|
||||
z: 0.157
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_center"
|
||||
parent: "panel_content"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: 300.0
|
||||
}
|
||||
size {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
}
|
||||
color {
|
||||
x: 0.129
|
||||
y: 0.141
|
||||
z: 0.157
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_n"
|
||||
pivot: PIVOT_N
|
||||
parent: "panel_content"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 200.0
|
||||
}
|
||||
size {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
}
|
||||
color {
|
||||
x: 0.129
|
||||
y: 0.141
|
||||
z: 0.157
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_e"
|
||||
pivot: PIVOT_E
|
||||
parent: "panel_content"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -200.0
|
||||
y: 300.0
|
||||
}
|
||||
size {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
}
|
||||
color {
|
||||
x: 0.129
|
||||
y: 0.141
|
||||
z: 0.157
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_nw"
|
||||
pivot: PIVOT_NW
|
||||
parent: "panel_content"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -200.0
|
||||
}
|
||||
size {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
}
|
||||
color {
|
||||
x: 0.129
|
||||
y: 0.141
|
||||
z: 0.157
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_w"
|
||||
pivot: PIVOT_W
|
||||
parent: "panel_content"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 200.0
|
||||
y: -300.0
|
||||
}
|
||||
size {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
}
|
||||
color {
|
||||
x: 0.129
|
||||
y: 0.141
|
||||
z: 0.157
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid_example/ui_circle_32"
|
||||
id: "anchor_se"
|
||||
pivot: PIVOT_SE
|
||||
parent: "panel_content"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
@@ -0,0 +1,26 @@
|
||||
---@class widget.container_anchors: druid.widget
|
||||
local M = {}
|
||||
|
||||
|
||||
function M:init()
|
||||
self.parent_container = self.druid:new_container("parent_container")
|
||||
self.parent_container:create_draggable_corners()
|
||||
|
||||
self.parent_container:add_container("panel_left", "stretch_y")
|
||||
self.parent_container:add_container("panel_right", "stretch_y")
|
||||
self.parent_container:add_container("panel_bot", "stretch_x")
|
||||
|
||||
self.container_content = self.parent_container:add_container("panel_content")
|
||||
self.container_content:add_container("anchor_ne")
|
||||
self.container_content:add_container("anchor_nw")
|
||||
self.container_content:add_container("anchor_se")
|
||||
self.container_content:add_container("anchor_sw")
|
||||
self.container_content:add_container("anchor_n")
|
||||
self.container_content:add_container("anchor_s")
|
||||
self.container_content:add_container("anchor_e")
|
||||
self.container_content:add_container("anchor_w")
|
||||
self.container_content:add_container("anchor_center")
|
||||
end
|
||||
|
||||
|
||||
return M
|
25
example/examples/container/examples_list.lua
Normal file
25
example/examples/container/examples_list.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
local M = {}
|
||||
|
||||
function M.get_examples()
|
||||
---@type druid.example.data[]
|
||||
return {
|
||||
{
|
||||
name_id = "ui_example_container_anchors",
|
||||
information_text_id = "ui_example_container_anchors_description",
|
||||
template = "container_anchors",
|
||||
root = "container_anchors/root",
|
||||
code_url = "example/examples/container/container_anchors/container_anchors.lua",
|
||||
widget_class = require("example.examples.container.container_anchors.container_anchors"),
|
||||
},
|
||||
{
|
||||
name_id = "ui_example_container_resize",
|
||||
information_text_id = "ui_example_container_resize_description",
|
||||
template = "container_resize",
|
||||
root = "container_resize/root",
|
||||
code_url = "example/examples/container/container_resize/container_resize.lua",
|
||||
widget_class = require("example.examples.container.container_resize.container_resize"),
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
@@ -6,6 +6,7 @@ local gamepad_examples = require("example.examples.gamepad.examples_list")
|
||||
local window_examples = require("example.examples.windows.examples_list")
|
||||
local widgets_examples = require("example.examples.widgets.examples_list")
|
||||
local panthera_examples = require("example.examples.panthera.examples_list")
|
||||
local container_examples = require("example.examples.container.examples_list")
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -45,7 +46,7 @@ function M.get_examples()
|
||||
add_examples(examples, "ui_examples_window", window_examples.get_examples())
|
||||
add_examples(examples, "ui_examples_panthera", panthera_examples.get_examples())
|
||||
add_examples(examples, "ui_examples_widgets", widgets_examples.get_examples())
|
||||
|
||||
add_examples(examples, "ui_examples_container", container_examples.get_examples())
|
||||
return examples
|
||||
end
|
||||
|
||||
|
@@ -38,13 +38,13 @@ end
|
||||
function M:on_input(action_id, action)
|
||||
if action_id == nil and gui.pick_node(self.root, action.x, action.y) then
|
||||
local root_screen_pos = gui.get_screen_position(self.root)
|
||||
local gui_scale = helper.get_gui_scale()
|
||||
local koef_x, koef_y = helper.get_screen_aspect_koef()
|
||||
|
||||
local dx = (action.screen_x - root_screen_pos.x) / gui_scale -- -root_size.x / 2 .. root_size.x / 2
|
||||
local dx = (action.screen_x - root_screen_pos.x) * koef_x -- -root_size.x / 2 .. root_size.x / 2
|
||||
local animation_progress_x = (dx + self.root_size.x / 2) / self.root_size.x -- 0 .. 1
|
||||
panthera.set_time(self.animation_horizontal, "horizontal", animation_progress_x)
|
||||
|
||||
local dy = (action.screen_y - root_screen_pos.y) / gui_scale -- -root_size.y / 2 .. root_size.y / 2
|
||||
local dy = (action.screen_y - root_screen_pos.y) * koef_y -- -root_size.y / 2 .. root_size.y / 2
|
||||
local animation_progress_y = (dy + self.root_size.y / 2) / self.root_size.y -- 0 .. 1
|
||||
panthera.set_time(self.animation_vertical, "vertical", animation_progress_y)
|
||||
end
|
||||
|
Reference in New Issue
Block a user