mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 10:02:18 +02:00
Update
This commit is contained in:
33
example/other/go_bindings/go_bindings.collection
Normal file
33
example/other/go_bindings/go_bindings.collection
Normal file
@@ -0,0 +1,33 @@
|
||||
name: "go_bindings"
|
||||
scale_along_z: 0
|
||||
embedded_instances {
|
||||
id: "go"
|
||||
data: "components {\n"
|
||||
" id: \"go_widget\"\n"
|
||||
" component: \"/example/other/go_bindings/go_widget.gui\"\n"
|
||||
"}\n"
|
||||
"components {\n"
|
||||
" id: \"go_bindings\"\n"
|
||||
" component: \"/example/other/go_bindings/go_bindings.script\"\n"
|
||||
"}\n"
|
||||
"embedded_components {\n"
|
||||
" id: \"sprite\"\n"
|
||||
" type: \"sprite\"\n"
|
||||
" data: \"default_animation: \\\"ui_circle_8\\\"\\n"
|
||||
"material: \\\"/builtins/materials/sprite.material\\\"\\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"
|
||||
"}\n"
|
||||
""
|
||||
position {
|
||||
x: 776.0
|
||||
y: 366.0
|
||||
}
|
||||
}
|
25
example/other/go_bindings/go_bindings.script
Normal file
25
example/other/go_bindings/go_bindings.script
Normal file
@@ -0,0 +1,25 @@
|
||||
local panthera = require("panthera.panthera")
|
||||
|
||||
local animation = require("example.other.go_bindings.go_bindings_panthera")
|
||||
|
||||
local druid = require("druid.druid")
|
||||
local widget = require("example.other.go_bindings.go_widget")
|
||||
|
||||
function init(self)
|
||||
self.go_widget = druid.get_widget(widget, "#go_widget")
|
||||
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,
|
||||
})
|
||||
|
||||
msg.post(".", "acquire_input_focus")
|
||||
end
|
||||
|
||||
|
||||
function update(self, dt)
|
||||
self.go_widget:set_position(go.get_position())
|
||||
end
|
||||
|
79
example/other/go_bindings/go_bindings_panthera.lua
Normal file
79
example/other/go_bindings/go_bindings_panthera.lua
Normal file
@@ -0,0 +1,79 @@
|
||||
return {
|
||||
data = {
|
||||
animations = {
|
||||
{
|
||||
animation_id = "default",
|
||||
animation_keys = {
|
||||
{
|
||||
duration = 1.13,
|
||||
easing = "outback",
|
||||
end_value = 706,
|
||||
key_type = "tween",
|
||||
node_id = "go",
|
||||
property_id = "position_x",
|
||||
start_value = 776,
|
||||
},
|
||||
{
|
||||
duration = 1.46,
|
||||
easing = "outback",
|
||||
end_value = 271,
|
||||
key_type = "tween",
|
||||
node_id = "go",
|
||||
property_id = "position_y",
|
||||
start_time = 1.13,
|
||||
start_value = 366,
|
||||
},
|
||||
{
|
||||
duration = 1.44,
|
||||
easing = "outback",
|
||||
end_value = 826,
|
||||
key_type = "tween",
|
||||
node_id = "go",
|
||||
property_id = "position_x",
|
||||
start_time = 2.59,
|
||||
start_value = 706,
|
||||
},
|
||||
{
|
||||
duration = 1.17,
|
||||
easing = "outback",
|
||||
end_value = 366,
|
||||
key_type = "tween",
|
||||
node_id = "go",
|
||||
property_id = "position_y",
|
||||
start_time = 4.02,
|
||||
start_value = 271,
|
||||
},
|
||||
{
|
||||
duration = 0.81,
|
||||
easing = "outback",
|
||||
end_value = 776,
|
||||
key_type = "tween",
|
||||
node_id = "go",
|
||||
property_id = "position_x",
|
||||
start_time = 5.19,
|
||||
start_value = 826,
|
||||
},
|
||||
},
|
||||
duration = 6,
|
||||
},
|
||||
},
|
||||
metadata = {
|
||||
fps = 60,
|
||||
gizmo_steps = {
|
||||
},
|
||||
gui_path = "/example/other/go_bindings/go_bindings.collection",
|
||||
layers = {
|
||||
},
|
||||
settings = {
|
||||
font_size = 30,
|
||||
},
|
||||
template_animation_paths = {
|
||||
},
|
||||
},
|
||||
nodes = {
|
||||
},
|
||||
},
|
||||
format = "json",
|
||||
type = "animation_editor",
|
||||
version = 1,
|
||||
}
|
156
example/other/go_bindings/go_widget.gui
Normal file
156
example/other/go_bindings/go_widget.gui
Normal file
@@ -0,0 +1,156 @@
|
||||
script: "/druid/druid.gui_script"
|
||||
fonts {
|
||||
name: "druid_text_bold"
|
||||
font: "/druid/fonts/druid_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: 20.0
|
||||
}
|
||||
size {
|
||||
x: 32.0
|
||||
y: 120.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/ui_circle_32"
|
||||
id: "circle"
|
||||
pivot: PIVOT_S
|
||||
parent: "root"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: 190.0
|
||||
}
|
||||
size {
|
||||
x: 200.0
|
||||
y: 100.0
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
text: "20"
|
||||
font: "druid_text_bold"
|
||||
id: "text"
|
||||
parent: "root"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 233.0
|
||||
y: 127.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "memory_panel"
|
||||
inherit_alpha: true
|
||||
template: "/druid/widget/memory_panel/memory_panel.gui"
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "memory_panel/root"
|
||||
parent: "memory_panel"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEMPLATE
|
||||
id: "memory_panel/mini_graph"
|
||||
parent: "memory_panel/root"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "memory_panel/mini_graph/root"
|
||||
parent: "memory_panel/mini_graph"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "memory_panel/mini_graph/header"
|
||||
parent: "memory_panel/mini_graph/root"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
id: "memory_panel/mini_graph/text_header"
|
||||
parent: "memory_panel/mini_graph/header"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "memory_panel/mini_graph/icon_drag"
|
||||
parent: "memory_panel/mini_graph/header"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "memory_panel/mini_graph/content"
|
||||
parent: "memory_panel/mini_graph/root"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "memory_panel/mini_graph/prefab_line"
|
||||
parent: "memory_panel/mini_graph/content"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "memory_panel/mini_graph/color_low"
|
||||
parent: "memory_panel/mini_graph/content"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "memory_panel/content"
|
||||
parent: "memory_panel/root"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
id: "memory_panel/text_max_value"
|
||||
parent: "memory_panel/content"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
id: "memory_panel/text_per_second"
|
||||
parent: "memory_panel/content"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "memory_panel/line_second_1"
|
||||
parent: "memory_panel/content"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "memory_panel/line_second_2"
|
||||
parent: "memory_panel/content"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
id: "memory_panel/text_memory"
|
||||
parent: "memory_panel/content"
|
||||
template_node_child: true
|
||||
}
|
||||
material: "/druid/materials/gui_world/gui_world.material"
|
||||
adjust_reference: ADJUST_REFERENCE_DISABLED
|
39
example/other/go_bindings/go_widget.lua
Normal file
39
example/other/go_bindings/go_widget.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
local panthera = require("panthera.panthera")
|
||||
|
||||
local animation = require("example.other.go_bindings.go_widget_panthera")
|
||||
local memory_panel = require("druid.widget.memory_panel.memory_panel")
|
||||
|
||||
---@class widget.go_widget: druid.widget
|
||||
local M = {}
|
||||
|
||||
|
||||
function M:init()
|
||||
print("init widget", msg.url())
|
||||
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)
|
||||
|
||||
self.memory_panel = self.druid:new_widget(memory_panel, "memory_panel")
|
||||
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
|
186
example/other/go_bindings/go_widget_panthera.lua
Normal file
186
example/other/go_bindings/go_widget_panthera.lua
Normal file
@@ -0,0 +1,186 @@
|
||||
return {
|
||||
data = {
|
||||
animations = {
|
||||
{
|
||||
animation_id = "default",
|
||||
animation_keys = {
|
||||
{
|
||||
easing = "outsine",
|
||||
end_value = 1.6,
|
||||
key_type = "tween",
|
||||
node_id = "text",
|
||||
property_id = "scale_x",
|
||||
start_value = 1,
|
||||
},
|
||||
{
|
||||
easing = "outsine",
|
||||
end_value = 1.6,
|
||||
key_type = "tween",
|
||||
node_id = "text",
|
||||
property_id = "scale_y",
|
||||
start_value = 1,
|
||||
},
|
||||
{
|
||||
duration = 0.15,
|
||||
easing = "outsine",
|
||||
end_value = 1,
|
||||
key_type = "tween",
|
||||
node_id = "text",
|
||||
property_id = "scale_x",
|
||||
start_value = 1.6,
|
||||
},
|
||||
{
|
||||
duration = 0.15,
|
||||
easing = "outsine",
|
||||
end_value = 1,
|
||||
key_type = "tween",
|
||||
node_id = "text",
|
||||
property_id = "scale_y",
|
||||
start_value = 1.6,
|
||||
},
|
||||
{
|
||||
duration = 0.39,
|
||||
easing = "outsine",
|
||||
end_value = 400,
|
||||
key_type = "tween",
|
||||
node_id = "text",
|
||||
property_id = "position_y",
|
||||
start_value = 190,
|
||||
},
|
||||
{
|
||||
duration = 0.43,
|
||||
easing = "outsine",
|
||||
end_value = 300,
|
||||
key_type = "tween",
|
||||
node_id = "circle",
|
||||
property_id = "size_y",
|
||||
start_value = 120,
|
||||
},
|
||||
{
|
||||
duration = 1,
|
||||
easing = "inoutexpo",
|
||||
end_value = 720,
|
||||
key_type = "tween",
|
||||
node_id = "root",
|
||||
property_id = "rotation_z",
|
||||
},
|
||||
{
|
||||
duration = 0.24,
|
||||
easing = "outsine",
|
||||
end_value = 2,
|
||||
key_type = "tween",
|
||||
node_id = "text",
|
||||
property_id = "scale_x",
|
||||
start_time = 0.15,
|
||||
start_value = 1,
|
||||
},
|
||||
{
|
||||
duration = 0.24,
|
||||
easing = "outsine",
|
||||
end_value = 2,
|
||||
key_type = "tween",
|
||||
node_id = "text",
|
||||
property_id = "scale_y",
|
||||
start_time = 0.15,
|
||||
start_value = 1,
|
||||
},
|
||||
{
|
||||
duration = 0.3,
|
||||
easing = "outsine",
|
||||
key_type = "tween",
|
||||
node_id = "circle",
|
||||
property_id = "color_b",
|
||||
start_time = 0.31,
|
||||
start_value = 1,
|
||||
},
|
||||
{
|
||||
duration = 0.3,
|
||||
easing = "outsine",
|
||||
key_type = "tween",
|
||||
node_id = "circle",
|
||||
property_id = "color_g",
|
||||
start_time = 0.31,
|
||||
start_value = 1,
|
||||
},
|
||||
{
|
||||
duration = 0.61,
|
||||
easing = "outsine",
|
||||
end_value = 1,
|
||||
key_type = "tween",
|
||||
node_id = "text",
|
||||
property_id = "scale_x",
|
||||
start_time = 0.39,
|
||||
start_value = 2,
|
||||
},
|
||||
{
|
||||
duration = 0.61,
|
||||
easing = "outsine",
|
||||
end_value = 1,
|
||||
key_type = "tween",
|
||||
node_id = "text",
|
||||
property_id = "scale_y",
|
||||
start_time = 0.39,
|
||||
start_value = 2,
|
||||
},
|
||||
{
|
||||
duration = 0.26,
|
||||
easing = "insine",
|
||||
end_value = 1,
|
||||
key_type = "tween",
|
||||
node_id = "circle",
|
||||
property_id = "color_b",
|
||||
start_time = 0.61,
|
||||
},
|
||||
{
|
||||
duration = 0.26,
|
||||
easing = "insine",
|
||||
end_value = 1,
|
||||
key_type = "tween",
|
||||
node_id = "circle",
|
||||
property_id = "color_g",
|
||||
start_time = 0.61,
|
||||
},
|
||||
{
|
||||
duration = 0.36,
|
||||
easing = "outsine",
|
||||
end_value = 190,
|
||||
key_type = "tween",
|
||||
node_id = "text",
|
||||
property_id = "position_y",
|
||||
start_time = 0.62,
|
||||
start_value = 400,
|
||||
},
|
||||
{
|
||||
duration = 0.35,
|
||||
easing = "outsine",
|
||||
end_value = 120,
|
||||
key_type = "tween",
|
||||
node_id = "circle",
|
||||
property_id = "size_y",
|
||||
start_time = 0.65,
|
||||
start_value = 300,
|
||||
},
|
||||
},
|
||||
duration = 1,
|
||||
},
|
||||
},
|
||||
metadata = {
|
||||
fps = 60,
|
||||
gizmo_steps = {
|
||||
},
|
||||
gui_path = "/example/other/go_bindings/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