mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
Update example with new brand one
This commit is contained in:
50
example/examples/basic/back_handler/basic_back_handler.gui
Normal file
50
example/examples/basic/back_handler/basic_back_handler.gui
Normal file
@@ -0,0 +1,50 @@
|
||||
fonts {
|
||||
name: "text_bold"
|
||||
font: "/example/assets/fonts/text_bold.font"
|
||||
}
|
||||
textures {
|
||||
name: "druid"
|
||||
texture: "/example/assets/druid.atlas"
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 1000.0
|
||||
y: 1000.0
|
||||
}
|
||||
color {
|
||||
x: 0.173
|
||||
y: 0.184
|
||||
z: 0.204
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/ui_circle_64"
|
||||
id: "root"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
z: 32.0
|
||||
w: 32.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 700.0
|
||||
y: 100.0
|
||||
}
|
||||
color {
|
||||
x: 0.522
|
||||
y: 0.522
|
||||
z: 0.522
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
text: "Press \"back\" to trigger a callback"
|
||||
font: "text_bold"
|
||||
id: "text"
|
||||
parent: "root"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
24
example/examples/basic/back_handler/basic_back_handler.lua
Normal file
24
example/examples/basic/back_handler/basic_back_handler.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
local component = require("druid.component")
|
||||
|
||||
---@class basic_back_handler: druid.base_component
|
||||
---@field druid druid_instance
|
||||
local M = component.create("basic_back_handler")
|
||||
|
||||
|
||||
---@param template string
|
||||
---@param nodes table<hash, node>
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
self.druid:new_back_handler(self.on_back)
|
||||
end
|
||||
|
||||
|
||||
function M:on_back()
|
||||
local node = self:get_node("text")
|
||||
gui.animate(node, gui.PROP_SCALE, vmath.vector3(1.2), gui.EASING_OUTELASTIC, 0.5, 0, function()
|
||||
gui.animate(node, gui.PROP_SCALE, vmath.vector3(1), gui.EASING_OUTELASTIC, 0.5)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
return M
|
Reference in New Issue
Block a user