mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 10:02:18 +02:00
Update Docs
This commit is contained in:
@@ -78,15 +78,27 @@ nodes {
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -240.0
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
id: "rich_input_2/placeholder_text"
|
||||
pivot: PIVOT_W
|
||||
parent: "rich_input_2/button"
|
||||
overridden_fields: 1
|
||||
overridden_fields: 14
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -240.0
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
id: "rich_input_2/input_text"
|
||||
pivot: PIVOT_W
|
||||
parent: "rich_input_2/button"
|
||||
overridden_fields: 1
|
||||
overridden_fields: 14
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
|
107
example/examples/widgets/go_widgets/go_bindings_panthera.lua
Normal file
107
example/examples/widgets/go_widgets/go_bindings_panthera.lua
Normal file
@@ -0,0 +1,107 @@
|
||||
return {
|
||||
data = {
|
||||
animations = {
|
||||
{
|
||||
animation_id = "default",
|
||||
animation_keys = {
|
||||
{
|
||||
duration = 1.305,
|
||||
easing = "outsine",
|
||||
end_value = 706,
|
||||
key_type = "tween",
|
||||
node_id = "go",
|
||||
property_id = "position_x",
|
||||
start_value = 960,
|
||||
},
|
||||
{
|
||||
duration = 3.03,
|
||||
easing = "outsine",
|
||||
end_value = 1.2,
|
||||
key_type = "tween",
|
||||
node_id = "go",
|
||||
property_id = "scale_x",
|
||||
start_value = 1,
|
||||
},
|
||||
{
|
||||
duration = 3.03,
|
||||
easing = "outsine",
|
||||
end_value = 1.2,
|
||||
key_type = "tween",
|
||||
node_id = "go",
|
||||
property_id = "scale_y",
|
||||
start_value = 1,
|
||||
},
|
||||
{
|
||||
duration = 1.689,
|
||||
easing = "outsine",
|
||||
end_value = 271,
|
||||
key_type = "tween",
|
||||
node_id = "go",
|
||||
property_id = "position_y",
|
||||
start_time = 1.305,
|
||||
start_value = 540,
|
||||
},
|
||||
{
|
||||
duration = 1.665,
|
||||
easing = "outsine",
|
||||
end_value = 960,
|
||||
key_type = "tween",
|
||||
node_id = "go",
|
||||
property_id = "position_x",
|
||||
start_time = 2.995,
|
||||
start_value = 706,
|
||||
},
|
||||
{
|
||||
duration = 2.97,
|
||||
easing = "outsine",
|
||||
end_value = 1,
|
||||
key_type = "tween",
|
||||
node_id = "go",
|
||||
property_id = "scale_x",
|
||||
start_time = 3.03,
|
||||
start_value = 1.2,
|
||||
},
|
||||
{
|
||||
duration = 2.97,
|
||||
easing = "outsine",
|
||||
end_value = 1,
|
||||
key_type = "tween",
|
||||
node_id = "go",
|
||||
property_id = "scale_y",
|
||||
start_time = 3.03,
|
||||
start_value = 1.2,
|
||||
},
|
||||
{
|
||||
duration = 1.353,
|
||||
easing = "outsine",
|
||||
end_value = 540,
|
||||
key_type = "tween",
|
||||
node_id = "go",
|
||||
property_id = "position_y",
|
||||
start_time = 4.647,
|
||||
start_value = 271,
|
||||
},
|
||||
},
|
||||
duration = 6,
|
||||
},
|
||||
},
|
||||
metadata = {
|
||||
fps = 60,
|
||||
gizmo_steps = {
|
||||
},
|
||||
gui_path = "/example/examples/widgets/go_widgets/go_widget.collection",
|
||||
layers = {
|
||||
},
|
||||
settings = {
|
||||
font_size = 30,
|
||||
},
|
||||
template_animation_paths = {
|
||||
},
|
||||
},
|
||||
nodes = {
|
||||
},
|
||||
},
|
||||
format = "json",
|
||||
type = "animation_editor",
|
||||
version = 1,
|
||||
}
|
97
example/examples/widgets/go_widgets/go_widget.collection
Normal file
97
example/examples/widgets/go_widgets/go_widget.collection
Normal file
@@ -0,0 +1,97 @@
|
||||
name: "go_bindings"
|
||||
scale_along_z: 0
|
||||
embedded_instances {
|
||||
id: "go"
|
||||
data: "components {\n"
|
||||
" id: \"go_widget\"\n"
|
||||
" component: \"/example/examples/widgets/go_widgets/go_widget.gui\"\n"
|
||||
"}\n"
|
||||
"components {\n"
|
||||
" id: \"go_bindings\"\n"
|
||||
" component: \"/example/examples/widgets/go_widgets/go_widget.script\"\n"
|
||||
"}\n"
|
||||
"components {\n"
|
||||
" id: \"druid\"\n"
|
||||
" component: \"/druid/druid.script\"\n"
|
||||
"}\n"
|
||||
"embedded_components {\n"
|
||||
" id: \"sprite\"\n"
|
||||
" type: \"sprite\"\n"
|
||||
" data: \"default_animation: \\\"ui_circle_64\\\"\\n"
|
||||
"material: \\\"/panthera/materials/sprite.material\\\"\\n"
|
||||
"attributes {\\n"
|
||||
" name: \\\"color\\\"\\n"
|
||||
" double_values {\\n"
|
||||
" v: 0.839\\n"
|
||||
" v: 0.808\\n"
|
||||
" v: 0.533\\n"
|
||||
" v: 1.0\\n"
|
||||
" }\\n"
|
||||
"}\\n"
|
||||
"textures {\\n"
|
||||
" sampler: \\\"texture_sampler\\\"\\n"
|
||||
" texture: \\\"/druid/druid.atlas\\\"\\n"
|
||||
"}\\n"
|
||||
"\"\n"
|
||||
" rotation {\n"
|
||||
" z: 0.70710677\n"
|
||||
" w: 0.70710677\n"
|
||||
" }\n"
|
||||
" scale {\n"
|
||||
" x: 3.0\n"
|
||||
" y: 3.0\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"embedded_components {\n"
|
||||
" id: \"sprite_outline\"\n"
|
||||
" type: \"sprite\"\n"
|
||||
" data: \"default_animation: \\\"ui_circle_64\\\"\\n"
|
||||
"material: \\\"/panthera/materials/sprite.material\\\"\\n"
|
||||
"blend_mode: BLEND_MODE_MULT\\n"
|
||||
"size {\\n"
|
||||
" x: 64.0\\n"
|
||||
" y: 64.0\\n"
|
||||
"}\\n"
|
||||
"attributes {\\n"
|
||||
" name: \\\"color\\\"\\n"
|
||||
" double_values {\\n"
|
||||
" v: 0.839\\n"
|
||||
" v: 0.808\\n"
|
||||
" v: 0.533\\n"
|
||||
" v: 1.0\\n"
|
||||
" }\\n"
|
||||
"}\\n"
|
||||
"textures {\\n"
|
||||
" sampler: \\\"texture_sampler\\\"\\n"
|
||||
" texture: \\\"/druid/druid.atlas\\\"\\n"
|
||||
"}\\n"
|
||||
"\"\n"
|
||||
" rotation {\n"
|
||||
" z: 0.70710677\n"
|
||||
" w: 0.70710677\n"
|
||||
" }\n"
|
||||
" scale {\n"
|
||||
" x: 3.1\n"
|
||||
" y: 3.1\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
""
|
||||
}
|
||||
embedded_instances {
|
||||
id: "camera"
|
||||
data: "embedded_components {\n"
|
||||
" id: \"camera\"\n"
|
||||
" type: \"camera\"\n"
|
||||
" data: \"aspect_ratio: 1.0\\n"
|
||||
"fov: 0.7854\\n"
|
||||
"near_z: 0.1\\n"
|
||||
"far_z: 1000.0\\n"
|
||||
"orthographic_projection: 1\\n"
|
||||
"orthographic_zoom: 0.4\\n"
|
||||
"\"\n"
|
||||
"}\n"
|
||||
""
|
||||
position {
|
||||
z: 10.0
|
||||
}
|
||||
}
|
108
example/examples/widgets/go_widgets/go_widget.gui
Normal file
108
example/examples/widgets/go_widgets/go_widget.gui
Normal file
@@ -0,0 +1,108 @@
|
||||
script: "/druid/druid_widget.gui_script"
|
||||
fonts {
|
||||
name: "druid_text_bold"
|
||||
font: "/example/assets/fonts/gui_world/druid_gui_world_text_bold.font"
|
||||
}
|
||||
textures {
|
||||
name: "druid"
|
||||
texture: "/druid/druid.atlas"
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
texture: "druid/empty"
|
||||
id: "root"
|
||||
inherit_alpha: true
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: 150.0
|
||||
}
|
||||
size {
|
||||
x: 200.0
|
||||
y: 100.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
id: "group"
|
||||
parent: "root"
|
||||
inherit_alpha: true
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 400.0
|
||||
y: 40.0
|
||||
}
|
||||
color {
|
||||
x: 0.886
|
||||
y: 0.518
|
||||
z: 0.518
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/ui_circle_32"
|
||||
id: "circle"
|
||||
parent: "group"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -200.0
|
||||
}
|
||||
size {
|
||||
x: 400.0
|
||||
y: 40.0
|
||||
}
|
||||
color {
|
||||
x: 0.447
|
||||
y: 0.784
|
||||
z: 0.522
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/ui_circle_32"
|
||||
id: "green"
|
||||
pivot: PIVOT_W
|
||||
parent: "circle"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 400.0
|
||||
y: 40.0
|
||||
}
|
||||
color {
|
||||
x: 0.173
|
||||
y: 0.184
|
||||
z: 0.204
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
text: "20"
|
||||
font: "druid_text_bold"
|
||||
id: "text"
|
||||
parent: "group"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
}
|
||||
material: "/druid/materials/gui_world/gui_world.material"
|
||||
adjust_reference: ADJUST_REFERENCE_DISABLED
|
||||
materials {
|
||||
name: "gui_tiling_node"
|
||||
material: "/druid/custom/tiling_node/gui_tiling_node.material"
|
||||
}
|
||||
materials {
|
||||
name: "gui_stencil"
|
||||
material: "/druid/materials/stencil/gui_stencil.material"
|
||||
}
|
35
example/examples/widgets/go_widgets/go_widget.lua
Normal file
35
example/examples/widgets/go_widgets/go_widget.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
local panthera = require("panthera.panthera")
|
||||
|
||||
local animation = require("example.examples.widgets.go_widgets.go_widget_panthera")
|
||||
|
||||
---@class examples.widget.go_widget: druid.widget
|
||||
local M = {}
|
||||
|
||||
|
||||
function M:init()
|
||||
self.root = self:get_node("root")
|
||||
self.circle = self:get_node("circle")
|
||||
self.animation = panthera.create_gui(animation)
|
||||
self.counter = 0
|
||||
self.text_counter = self:get_node("text")
|
||||
gui.set_text(self.text_counter, 0)
|
||||
end
|
||||
|
||||
|
||||
function M:play_animation()
|
||||
panthera.play(self.animation, "default", {
|
||||
is_loop = true,
|
||||
callback = function()
|
||||
self.counter = self.counter + 1
|
||||
gui.set_text(self.text_counter, self.counter)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
---@param position vector3 The position to set
|
||||
function M:set_position(position)
|
||||
gui.set_position(self.root, position)
|
||||
end
|
||||
|
||||
return M
|
27
example/examples/widgets/go_widgets/go_widget.script
Normal file
27
example/examples/widgets/go_widgets/go_widget.script
Normal file
@@ -0,0 +1,27 @@
|
||||
local panthera = require("panthera.panthera")
|
||||
|
||||
local animation = require("example.examples.widgets.go_widgets.go_bindings_panthera")
|
||||
|
||||
local druid = require("druid.druid")
|
||||
local widget = require("example.examples.widgets.go_widgets.go_widget")
|
||||
|
||||
function init(self)
|
||||
local gui_url = msg.url(nil, nil, "go_widget")
|
||||
self.go_widget = druid.get_widget(widget, gui_url)
|
||||
self.go_widget:play_animation()
|
||||
self.go_widget:set_position(go.get_position())
|
||||
|
||||
self.animation = panthera.create_go(animation)
|
||||
panthera.play(self.animation, "default", {
|
||||
is_loop = true,
|
||||
speed = 2,
|
||||
})
|
||||
|
||||
msg.post(".", "acquire_input_focus")
|
||||
end
|
||||
|
||||
|
||||
function update(self, dt)
|
||||
self.go_widget:set_position(go.get_position())
|
||||
end
|
||||
|
66
example/examples/widgets/go_widgets/go_widget_panthera.lua
Normal file
66
example/examples/widgets/go_widgets/go_widget_panthera.lua
Normal file
@@ -0,0 +1,66 @@
|
||||
return {
|
||||
data = {
|
||||
animations = {
|
||||
{
|
||||
animation_id = "default",
|
||||
animation_keys = {
|
||||
{
|
||||
duration = 0.9,
|
||||
easing = "outsine",
|
||||
end_value = -180,
|
||||
key_type = "tween",
|
||||
node_id = "text",
|
||||
property_id = "position_x",
|
||||
},
|
||||
{
|
||||
duration = 0.95,
|
||||
easing = "outsine",
|
||||
end_value = 40,
|
||||
key_type = "tween",
|
||||
node_id = "green",
|
||||
property_id = "size_x",
|
||||
start_value = 400,
|
||||
},
|
||||
{
|
||||
duration = 0.37,
|
||||
easing = "insine",
|
||||
end_value = 400,
|
||||
key_type = "tween",
|
||||
node_id = "green",
|
||||
property_id = "size_x",
|
||||
start_time = 1.08,
|
||||
start_value = 40,
|
||||
},
|
||||
{
|
||||
duration = 0.71,
|
||||
easing = "outsine",
|
||||
key_type = "tween",
|
||||
node_id = "text",
|
||||
property_id = "position_x",
|
||||
start_time = 1.29,
|
||||
start_value = -180,
|
||||
},
|
||||
},
|
||||
duration = 2,
|
||||
},
|
||||
},
|
||||
metadata = {
|
||||
fps = 60,
|
||||
gizmo_steps = {
|
||||
},
|
||||
gui_path = "/example/examples/widgets/go_widgets/go_widget.gui",
|
||||
layers = {
|
||||
},
|
||||
settings = {
|
||||
font_size = 30,
|
||||
},
|
||||
template_animation_paths = {
|
||||
},
|
||||
},
|
||||
nodes = {
|
||||
},
|
||||
},
|
||||
format = "json",
|
||||
type = "animation_editor",
|
||||
version = 1,
|
||||
}
|
Reference in New Issue
Block a user