Update examples

This commit is contained in:
Insality
2025-03-27 00:30:37 +02:00
parent 7640e207a4
commit b053b5044b
15 changed files with 125 additions and 146 deletions

View File

@@ -1,21 +1,29 @@
local component = require("druid.component")
---@class examples.gamepad_tester: druid.component
---@class examples.gamepad_tester: druid.widget
---@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")
---@field button_left druid.button
---@field button_right druid.button
---@field button_up druid.button
---@field button_down druid.button
---@field button_x druid.button
---@field button_b druid.button
---@field button_y druid.button
---@field button_a druid.button
---@field button_l1 druid.button
---@field button_r1 druid.button
---@field button_stick_left druid.button
---@field button_stick_right druid.button
---@field button_start druid.button
---@field button_back druid.button
---@field trigger_l2 druid.progress
---@field trigger_r2 druid.progress
---@field stick_left node
---@field stick_right node
local M = {}
local STICK_DISTANCE = 50
---@param template string
---@param nodes table<hash, node>
function M:init(template, nodes)
self.druid = self:get_druid(template, nodes)
function M:init()
self.root = self:get_node("root")
self.button_left = self.druid:new_button("button_left/button"):set_key_trigger("gamepad_lpad_left")