mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Update example with new brand one
This commit is contained in:
725
example/examples/gamepad/gamepad_tester/gamepad_tester.gui
Normal file
725
example/examples/gamepad/gamepad_tester/gamepad_tester.gui
Normal file
@@ -0,0 +1,725 @@
|
||||
textures {
|
||||
name: "druid"
|
||||
texture: "/example/assets/druid.atlas"
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 1000.0
|
||||
y: 1000.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/empty"
|
||||
id: "root"
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 200.0
|
||||
y: 100.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/empty"
|
||||
id: "gamepad"
|
||||
parent: "root"
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -200.0
|
||||
y: -300.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "stick_left"
|
||||
parent: "gamepad"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_stick.gui"
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_left/root"
|
||||
parent: "stick_left"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_PIE
|
||||
id: "stick_left/background_mask"
|
||||
parent: "stick_left/root"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_left/background"
|
||||
parent: "stick_left/background_mask"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_left/stick_root"
|
||||
parent: "stick_left/root"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_left/stick_shadow"
|
||||
parent: "stick_left/stick_root"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_left/stick"
|
||||
parent: "stick_left/stick_root"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_left/dot_1"
|
||||
parent: "stick_left/stick"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_left/dot_2"
|
||||
parent: "stick_left/stick"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_left/dot_3"
|
||||
parent: "stick_left/stick"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_left/dot_4"
|
||||
parent: "stick_left/stick"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 200.0
|
||||
y: -300.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "stick_right"
|
||||
parent: "gamepad"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_stick.gui"
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_right/root"
|
||||
parent: "stick_right"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_PIE
|
||||
id: "stick_right/background_mask"
|
||||
parent: "stick_right/root"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_right/background"
|
||||
parent: "stick_right/background_mask"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_right/stick_root"
|
||||
parent: "stick_right/root"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_right/stick_shadow"
|
||||
parent: "stick_right/stick_root"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_right/stick"
|
||||
parent: "stick_right/stick_root"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_right/dot_1"
|
||||
parent: "stick_right/stick"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_right/dot_2"
|
||||
parent: "stick_right/stick"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_right/dot_3"
|
||||
parent: "stick_right/stick"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "stick_right/dot_4"
|
||||
parent: "stick_right/stick"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -330.0
|
||||
y: 24.0
|
||||
}
|
||||
size {
|
||||
x: 290.0
|
||||
y: 290.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/empty"
|
||||
id: "dpad"
|
||||
parent: "gamepad"
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -100.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "button_left"
|
||||
parent: "dpad"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_button.gui"
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_left/button"
|
||||
parent: "button_left"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
id: "button_left/text"
|
||||
parent: "button_left/button"
|
||||
overridden_fields: 45
|
||||
overridden_fields: 46
|
||||
template_node_child: true
|
||||
enabled: false
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
rotation {
|
||||
z: 180.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
id: "button_left/icon"
|
||||
parent: "button_left/button"
|
||||
overridden_fields: 2
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: 100.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "button_up"
|
||||
parent: "dpad"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_button.gui"
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_up/button"
|
||||
parent: "button_up"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
id: "button_up/text"
|
||||
parent: "button_up/button"
|
||||
overridden_fields: 45
|
||||
overridden_fields: 46
|
||||
template_node_child: true
|
||||
enabled: false
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
rotation {
|
||||
z: 90.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
id: "button_up/icon"
|
||||
parent: "button_up/button"
|
||||
overridden_fields: 2
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 100.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "button_right"
|
||||
parent: "dpad"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_button.gui"
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_right/button"
|
||||
parent: "button_right"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
id: "button_right/text"
|
||||
parent: "button_right/button"
|
||||
overridden_fields: 45
|
||||
overridden_fields: 46
|
||||
template_node_child: true
|
||||
enabled: false
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_right/icon"
|
||||
parent: "button_right/button"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: -100.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "button_down"
|
||||
parent: "dpad"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_button.gui"
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_down/button"
|
||||
parent: "button_down"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
id: "button_down/text"
|
||||
parent: "button_down/button"
|
||||
overridden_fields: 45
|
||||
overridden_fields: 46
|
||||
template_node_child: true
|
||||
enabled: false
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
rotation {
|
||||
z: -90.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
id: "button_down/icon"
|
||||
parent: "button_down/button"
|
||||
overridden_fields: 2
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 330.0
|
||||
y: 24.0
|
||||
}
|
||||
size {
|
||||
x: 290.0
|
||||
y: 290.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/empty"
|
||||
id: "buttons"
|
||||
parent: "gamepad"
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -100.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "button_x"
|
||||
parent: "buttons"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_button.gui"
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_x/button"
|
||||
parent: "button_x"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
id: "button_x/text"
|
||||
parent: "button_x/button"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_x/icon"
|
||||
parent: "button_x/button"
|
||||
overridden_fields: 45
|
||||
template_node_child: true
|
||||
enabled: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: 100.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "button_y"
|
||||
parent: "buttons"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_button.gui"
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_y/button"
|
||||
parent: "button_y"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
text: "Y"
|
||||
id: "button_y/text"
|
||||
parent: "button_y/button"
|
||||
overridden_fields: 8
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_y/icon"
|
||||
parent: "button_y/button"
|
||||
overridden_fields: 45
|
||||
template_node_child: true
|
||||
enabled: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 100.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "button_b"
|
||||
parent: "buttons"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_button.gui"
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_b/button"
|
||||
parent: "button_b"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
text: "B"
|
||||
id: "button_b/text"
|
||||
parent: "button_b/button"
|
||||
overridden_fields: 8
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_b/icon"
|
||||
parent: "button_b/button"
|
||||
overridden_fields: 45
|
||||
template_node_child: true
|
||||
enabled: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: -100.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "button_a"
|
||||
parent: "buttons"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_button.gui"
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_a/button"
|
||||
parent: "button_a"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
text: "A"
|
||||
id: "button_a/text"
|
||||
parent: "button_a/button"
|
||||
overridden_fields: 8
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_a/icon"
|
||||
parent: "button_a/button"
|
||||
overridden_fields: 45
|
||||
template_node_child: true
|
||||
enabled: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: 160.0
|
||||
}
|
||||
size {
|
||||
x: 290.0
|
||||
y: 290.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/empty"
|
||||
id: "buttons_system"
|
||||
parent: "gamepad"
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -110.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "button_back"
|
||||
parent: "buttons_system"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_button.gui"
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 180.0
|
||||
y: 90.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
id: "button_back/button"
|
||||
parent: "button_back"
|
||||
overridden_fields: 4
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
text: "Back"
|
||||
id: "button_back/text"
|
||||
parent: "button_back/button"
|
||||
overridden_fields: 8
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_back/icon"
|
||||
parent: "button_back/button"
|
||||
overridden_fields: 45
|
||||
template_node_child: true
|
||||
enabled: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 110.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "button_start"
|
||||
parent: "buttons_system"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_button.gui"
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 180.0
|
||||
y: 90.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
id: "button_start/button"
|
||||
parent: "button_start"
|
||||
overridden_fields: 4
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
text: "Start"
|
||||
id: "button_start/text"
|
||||
parent: "button_start/button"
|
||||
overridden_fields: 8
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_start/icon"
|
||||
parent: "button_start/button"
|
||||
overridden_fields: 45
|
||||
template_node_child: true
|
||||
enabled: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -330.0
|
||||
y: 360.0
|
||||
}
|
||||
size {
|
||||
x: 200.0
|
||||
y: 200.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/empty"
|
||||
id: "button_left_bump"
|
||||
parent: "gamepad"
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -3.0
|
||||
y: -57.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "button_l1"
|
||||
parent: "button_left_bump"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_button.gui"
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 180.0
|
||||
y: 90.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
id: "button_l1/button"
|
||||
parent: "button_l1"
|
||||
overridden_fields: 4
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
text: "L1"
|
||||
id: "button_l1/text"
|
||||
parent: "button_l1/button"
|
||||
overridden_fields: 8
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_l1/icon"
|
||||
parent: "button_l1/button"
|
||||
overridden_fields: 45
|
||||
template_node_child: true
|
||||
enabled: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: 60.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "button_l2"
|
||||
parent: "button_left_bump"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_trigger.gui"
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_l2/button"
|
||||
parent: "button_l2"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_l2/fill"
|
||||
parent: "button_l2/button"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
text: "L2"
|
||||
id: "button_l2/text"
|
||||
parent: "button_l2/button"
|
||||
overridden_fields: 8
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 330.0
|
||||
y: 360.0
|
||||
}
|
||||
size {
|
||||
x: 200.0
|
||||
y: 200.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/empty"
|
||||
id: "button_right_bump"
|
||||
parent: "gamepad"
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: -60.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "button_r1"
|
||||
parent: "button_right_bump"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_button.gui"
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 180.0
|
||||
y: 90.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
id: "button_r1/button"
|
||||
parent: "button_r1"
|
||||
overridden_fields: 4
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
text: "R1"
|
||||
id: "button_r1/text"
|
||||
parent: "button_r1/button"
|
||||
overridden_fields: 8
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_r1/icon"
|
||||
parent: "button_r1/button"
|
||||
overridden_fields: 45
|
||||
template_node_child: true
|
||||
enabled: false
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: 60.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "button_r2"
|
||||
parent: "button_right_bump"
|
||||
inherit_alpha: true
|
||||
template: "/example/examples/gamepad/gamepad_tester/templates/gamepad_trigger.gui"
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_r2/button"
|
||||
parent: "button_r2"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
id: "button_r2/fill"
|
||||
parent: "button_r2/button"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_TEXT
|
||||
text: "R2"
|
||||
id: "button_r2/text"
|
||||
parent: "button_r2/button"
|
||||
overridden_fields: 8
|
||||
template_node_child: true
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
87
example/examples/gamepad/gamepad_tester/gamepad_tester.lua
Normal file
87
example/examples/gamepad/gamepad_tester/gamepad_tester.lua
Normal file
@@ -0,0 +1,87 @@
|
||||
local component = require("druid.component")
|
||||
local progress = require("druid.extended.progress")
|
||||
|
||||
---@class gamepad_tester: druid.base_component
|
||||
---@field root node
|
||||
---@field buttons druid.button
|
||||
---@field buttons_system druid.button
|
||||
---@field button_left_bump druid.button
|
||||
---@field button_right_bump druid.button
|
||||
---@field druid druid_instance
|
||||
local M = component.create("gamepad_tester")
|
||||
|
||||
local STICK_DISTANCE = 50
|
||||
|
||||
---@param template string
|
||||
---@param nodes table<hash, node>
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
|
||||
self.root = self:get_node("root")
|
||||
|
||||
self.button_left = self.druid:new_button("button_left/button"):set_key_trigger("gamepad_lpad_left")
|
||||
self.button_right = self.druid:new_button("button_right/button"):set_key_trigger("gamepad_lpad_right")
|
||||
self.button_up = self.druid:new_button("button_up/button"):set_key_trigger("gamepad_lpad_up")
|
||||
self.button_down = self.druid:new_button("button_down/button"):set_key_trigger("gamepad_lpad_down")
|
||||
|
||||
self.button_x = self.druid:new_button("button_x/button"):set_key_trigger("gamepad_rpad_left")
|
||||
self.button_b = self.druid:new_button("button_b/button"):set_key_trigger("gamepad_rpad_right")
|
||||
self.button_y = self.druid:new_button("button_y/button"):set_key_trigger("gamepad_rpad_up")
|
||||
self.button_a = self.druid:new_button("button_a/button"):set_key_trigger("gamepad_rpad_down")
|
||||
|
||||
self.button_l1 = self.druid:new_button("button_l1/button"):set_key_trigger("gamepad_lshoulder")
|
||||
self.button_r1 = self.druid:new_button("button_r1/button"):set_key_trigger("gamepad_rshoulder")
|
||||
|
||||
self.button_stick_left = self.druid:new_button("stick_left/root"):set_key_trigger("gamepad_lstick_click")
|
||||
self.button_stick_right = self.druid:new_button("stick_right/root"):set_key_trigger("gamepad_rstick_click")
|
||||
|
||||
self.button_start = self.druid:new_button("button_start/button"):set_key_trigger("gamepad_start")
|
||||
self.button_back = self.druid:new_button("button_back/button"):set_key_trigger("gamepad_back")
|
||||
|
||||
self.trigger_l2 = self.druid:new(progress, "button_l2/fill", "x", 0) --[[@as druid.progress]]
|
||||
self.trigger_r2 = self.druid:new(progress, "button_r2/fill", "x", 0) --[[@as druid.progress]]
|
||||
|
||||
self.stick_left = self:get_node("stick_left/stick_root")
|
||||
self.stick_right = self:get_node("stick_right/stick_root")
|
||||
end
|
||||
|
||||
|
||||
function M:on_input(action_id, action)
|
||||
if action_id == hash("gamepad_ltrigger") then
|
||||
self.trigger_l2:set_to(action.value)
|
||||
end
|
||||
if action_id == hash("gamepad_rtrigger") then
|
||||
self.trigger_r2:set_to(action.value)
|
||||
end
|
||||
|
||||
-- Left Stick
|
||||
if action_id == hash("gamepad_lstick_left") then
|
||||
gui.set(self.stick_left, "position.x", -action.value * STICK_DISTANCE)
|
||||
end
|
||||
if action_id == hash("gamepad_lstick_right") then
|
||||
gui.set(self.stick_left, "position.x", action.value * STICK_DISTANCE)
|
||||
end
|
||||
if action_id == hash("gamepad_lstick_up") then
|
||||
gui.set(self.stick_left, "position.y", action.value * STICK_DISTANCE)
|
||||
end
|
||||
if action_id == hash("gamepad_lstick_down") then
|
||||
gui.set(self.stick_left, "position.y", -action.value * STICK_DISTANCE)
|
||||
end
|
||||
|
||||
-- Right Stick
|
||||
if action_id == hash("gamepad_rstick_left") then
|
||||
gui.set(self.stick_right, "position.x", -action.value * STICK_DISTANCE)
|
||||
end
|
||||
if action_id == hash("gamepad_rstick_right") then
|
||||
gui.set(self.stick_right, "position.x", action.value * STICK_DISTANCE)
|
||||
end
|
||||
if action_id == hash("gamepad_rstick_up") then
|
||||
gui.set(self.stick_right, "position.y", action.value * STICK_DISTANCE)
|
||||
end
|
||||
if action_id == hash("gamepad_rstick_down") then
|
||||
gui.set(self.stick_right, "position.y", -action.value * STICK_DISTANCE)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return M
|
@@ -0,0 +1,202 @@
|
||||
script: ""
|
||||
fonts {
|
||||
name: "text_bold"
|
||||
font: "/example/assets/fonts/text_bold.font"
|
||||
}
|
||||
textures {
|
||||
name: "druid"
|
||||
texture: "/example/assets/druid.atlas"
|
||||
}
|
||||
background_color {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.0
|
||||
w: 0.0
|
||||
}
|
||||
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: 90.0
|
||||
y: 90.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
color {
|
||||
x: 0.31
|
||||
y: 0.318
|
||||
z: 0.322
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
texture: "druid/ui_circle_32"
|
||||
id: "button"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_CENTER
|
||||
adjust_mode: ADJUST_MODE_FIT
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
clipping_mode: CLIPPING_MODE_NONE
|
||||
clipping_visible: true
|
||||
clipping_inverted: false
|
||||
alpha: 1.0
|
||||
template_node_child: false
|
||||
size_mode: SIZE_MODE_MANUAL
|
||||
custom_type: 0
|
||||
enabled: true
|
||||
visible: true
|
||||
material: ""
|
||||
}
|
||||
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.5
|
||||
y: 1.5
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
size {
|
||||
x: 40.0
|
||||
y: 40.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
color {
|
||||
x: 0.941
|
||||
y: 0.984
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "X"
|
||||
font: "text_bold"
|
||||
id: "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: "button"
|
||||
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
|
||||
custom_type: 0
|
||||
enabled: true
|
||||
visible: true
|
||||
material: ""
|
||||
}
|
||||
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: 0.941
|
||||
y: 0.984
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
texture: "druid/icon_arrow"
|
||||
id: "icon"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_CENTER
|
||||
adjust_mode: ADJUST_MODE_FIT
|
||||
parent: "button"
|
||||
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
|
||||
custom_type: 0
|
||||
enabled: true
|
||||
visible: true
|
||||
material: ""
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
max_nodes: 512
|
@@ -0,0 +1,191 @@
|
||||
fonts {
|
||||
name: "text_bold"
|
||||
font: "/example/assets/fonts/text_bold.font"
|
||||
}
|
||||
textures {
|
||||
name: "druid"
|
||||
texture: "/example/assets/druid.atlas"
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 12.0
|
||||
y: 12.0
|
||||
}
|
||||
color {
|
||||
x: 0.31
|
||||
y: 0.318
|
||||
z: 0.322
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/empty"
|
||||
id: "root"
|
||||
inherit_alpha: true
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 256.0
|
||||
y: 256.0
|
||||
}
|
||||
type: TYPE_PIE
|
||||
id: "background_mask"
|
||||
parent: "root"
|
||||
inherit_alpha: true
|
||||
perimeterVertices: 64
|
||||
clipping_mode: CLIPPING_MODE_STENCIL
|
||||
clipping_visible: false
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
x: 256.0
|
||||
y: 256.0
|
||||
}
|
||||
color {
|
||||
x: 0.31
|
||||
y: 0.318
|
||||
z: 0.322
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/pixel"
|
||||
id: "background"
|
||||
parent: "background_mask"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 1.0
|
||||
y: 1.0
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
}
|
||||
nodes {
|
||||
type: TYPE_BOX
|
||||
texture: "druid/empty"
|
||||
id: "stick_root"
|
||||
parent: "root"
|
||||
inherit_alpha: true
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
visible: false
|
||||
}
|
||||
nodes {
|
||||
scale {
|
||||
x: 2.0
|
||||
y: 2.0
|
||||
}
|
||||
color {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/ui_circle_64_blur_8"
|
||||
id: "stick_shadow"
|
||||
parent: "stick_root"
|
||||
inherit_alpha: true
|
||||
alpha: 0.25
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
}
|
||||
nodes {
|
||||
scale {
|
||||
x: 2.0
|
||||
y: 2.0
|
||||
}
|
||||
color {
|
||||
x: 0.463
|
||||
y: 0.475
|
||||
z: 0.49
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/ui_circle_64"
|
||||
id: "stick"
|
||||
parent: "stick_root"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 32.0
|
||||
y: 32.0
|
||||
z: 32.0
|
||||
w: 32.0
|
||||
}
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -22.0
|
||||
}
|
||||
scale {
|
||||
x: 0.5
|
||||
y: 0.5
|
||||
}
|
||||
color {
|
||||
x: 0.31
|
||||
y: 0.318
|
||||
z: 0.322
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/ui_circle_16"
|
||||
id: "dot_1"
|
||||
parent: "stick"
|
||||
inherit_alpha: true
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: 22.0
|
||||
}
|
||||
scale {
|
||||
x: 0.5
|
||||
y: 0.5
|
||||
}
|
||||
color {
|
||||
x: 0.31
|
||||
y: 0.318
|
||||
z: 0.322
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/ui_circle_16"
|
||||
id: "dot_2"
|
||||
parent: "stick"
|
||||
inherit_alpha: true
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: 22.0
|
||||
}
|
||||
scale {
|
||||
x: 0.5
|
||||
y: 0.5
|
||||
}
|
||||
color {
|
||||
x: 0.31
|
||||
y: 0.318
|
||||
z: 0.322
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/ui_circle_16"
|
||||
id: "dot_3"
|
||||
parent: "stick"
|
||||
inherit_alpha: true
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: -22.0
|
||||
}
|
||||
scale {
|
||||
x: 0.5
|
||||
y: 0.5
|
||||
}
|
||||
color {
|
||||
x: 0.31
|
||||
y: 0.318
|
||||
z: 0.322
|
||||
}
|
||||
type: TYPE_BOX
|
||||
texture: "druid/ui_circle_16"
|
||||
id: "dot_4"
|
||||
parent: "stick"
|
||||
inherit_alpha: true
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
@@ -0,0 +1,202 @@
|
||||
script: ""
|
||||
fonts {
|
||||
name: "text_bold"
|
||||
font: "/example/assets/fonts/text_bold.font"
|
||||
}
|
||||
textures {
|
||||
name: "druid"
|
||||
texture: "/example/assets/druid.atlas"
|
||||
}
|
||||
background_color {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.0
|
||||
w: 0.0
|
||||
}
|
||||
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: 180.0
|
||||
y: 90.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
color {
|
||||
x: 0.31
|
||||
y: 0.318
|
||||
z: 0.322
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
texture: "druid/ui_circle_32"
|
||||
id: "button"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_CENTER
|
||||
adjust_mode: ADJUST_MODE_FIT
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
clipping_mode: CLIPPING_MODE_NONE
|
||||
clipping_visible: true
|
||||
clipping_inverted: false
|
||||
alpha: 1.0
|
||||
template_node_child: false
|
||||
size_mode: SIZE_MODE_MANUAL
|
||||
custom_type: 0
|
||||
enabled: true
|
||||
visible: true
|
||||
material: ""
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -90.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: 180.0
|
||||
y: 90.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
color {
|
||||
x: 0.631
|
||||
y: 0.843
|
||||
z: 0.961
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
texture: "druid/ui_circle_32"
|
||||
id: "fill"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_W
|
||||
adjust_mode: ADJUST_MODE_FIT
|
||||
parent: "button"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
clipping_mode: CLIPPING_MODE_NONE
|
||||
clipping_visible: true
|
||||
clipping_inverted: false
|
||||
alpha: 1.0
|
||||
template_node_child: false
|
||||
size_mode: SIZE_MODE_MANUAL
|
||||
custom_type: 0
|
||||
enabled: true
|
||||
visible: true
|
||||
material: ""
|
||||
}
|
||||
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.5
|
||||
y: 1.5
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
size {
|
||||
x: 40.0
|
||||
y: 40.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
color {
|
||||
x: 0.941
|
||||
y: 0.984
|
||||
z: 1.0
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "X"
|
||||
font: "text_bold"
|
||||
id: "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: "button"
|
||||
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
|
||||
custom_type: 0
|
||||
enabled: true
|
||||
visible: true
|
||||
material: ""
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
max_nodes: 512
|
Reference in New Issue
Block a user