gd: added input addon

This commit is contained in:
2025-05-27 19:20:46 +02:00
parent d8a1604af9
commit c8d8c7ec25
683 changed files with 21608 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://veqjcwokdukw"
path="res://.godot/imported/button_empty.png-123d9e156dcc9c2e5ff33e4ffbcd7884.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/guide/ui/renderers/joy/icons/button_empty.png"
dest_files=["res://.godot/imported/button_empty.png-123d9e156dcc9c2e5ff33e4ffbcd7884.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://do001o6aysaxo"
path="res://.godot/imported/stick_empty.png-10fa96eb31f6946670d6998f8648c1db.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/guide/ui/renderers/joy/icons/stick_empty.png"
dest_files=["res://.godot/imported/stick_empty.png-10fa96eb31f6946670d6998f8648c1db.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@ -0,0 +1,69 @@
@tool
extends GUIDEIconRenderer
@onready var _stick:Control = %Stick
@onready var _button:Control = %Button
@onready var _text:Control = %Text
@onready var _directions:Control = %Directions
@onready var _horizontal:Control = %Horizontal
@onready var _vertical:Control = %Vertical
func supports(input:GUIDEInput) -> bool:
return input is GUIDEInputJoyBase
func render(input:GUIDEInput) -> void:
_stick.visible = false
_button.visible = false
_directions.visible = false
_horizontal.visible = false
_vertical.visible = false
_text.text = ""
if input is GUIDEInputJoyAxis1D:
_stick.visible = true
match input.axis:
JOY_AXIS_LEFT_X:
_directions.visible = true
_text.text = "1"
_horizontal.visible = true
JOY_AXIS_RIGHT_X:
_directions.visible = true
_text.text = "2"
_horizontal.visible = true
JOY_AXIS_LEFT_Y:
_directions.visible = true
_text.text = "1"
_vertical.visible = true
JOY_AXIS_RIGHT_Y:
_directions.visible = true
_text.text = "2"
_vertical.visible = true
JOY_AXIS_TRIGGER_LEFT:
_text.text = "3"
JOY_AXIS_TRIGGER_RIGHT:
_text.text = "4"
if input is GUIDEInputJoyAxis2D:
_stick.visible = true
match input.x:
JOY_AXIS_LEFT_X, JOY_AXIS_LEFT_Y:
_text.text = "1"
JOY_AXIS_RIGHT_X, JOY_AXIS_RIGHT_Y:
_text.text = "2"
_:
# well we don't know really what this is but what can we do.
_text.text = str(input.x + input.y)
if input is GUIDEInputJoyButton:
_button.visible = true
_text.text = str(input.button)
call("queue_sort")
func cache_key(input:GUIDEInput) -> String:
return "a9ced629-de65-4c31-9de0-8e4cbf88a2e0" + input.to_string()

View File

@ -0,0 +1 @@
uid://bnk4uahoa45vc

View File

@ -0,0 +1,63 @@
[gd_scene load_steps=7 format=3 uid="uid://c6sqf8rur1wss"]
[ext_resource type="Script" path="res://addons/guide/ui/renderers/joy/joy_renderer.gd" id="1_u7brn"]
[ext_resource type="Texture2D" uid="uid://do001o6aysaxo" path="res://addons/guide/ui/renderers/joy/icons/stick_empty.png" id="2_23u2k"]
[ext_resource type="Texture2D" uid="uid://veqjcwokdukw" path="res://addons/guide/ui/renderers/joy/icons/button_empty.png" id="3_7qfbp"]
[ext_resource type="FontFile" uid="uid://cu8bvod6tnnwr" path="res://addons/guide/ui/renderers/keyboard/Lato-Black.ttf" id="4_otp86"]
[ext_resource type="Texture2D" uid="uid://bmgxqbypegjxh" path="res://addons/guide/ui/renderers/textures/arrow_horizontal.svg" id="5_81uyo"]
[ext_resource type="Texture2D" uid="uid://bu5nlug6uf03w" path="res://addons/guide/ui/renderers/textures/arrow_vertical.svg" id="6_syx8c"]
[node name="JoyRenderer" type="MarginContainer"]
offset_right = 100.0
offset_bottom = 100.0
size_flags_horizontal = 0
script = ExtResource("1_u7brn")
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 2
[node name="Controls" type="MarginContainer" parent="HBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(100, 100)
layout_mode = 2
[node name="Stick" type="TextureRect" parent="HBoxContainer/Controls"]
unique_name_in_owner = true
layout_mode = 2
texture = ExtResource("2_23u2k")
stretch_mode = 4
[node name="Button" type="TextureRect" parent="HBoxContainer/Controls"]
unique_name_in_owner = true
layout_mode = 2
texture = ExtResource("3_7qfbp")
stretch_mode = 4
[node name="Text" type="Label" parent="HBoxContainer/Controls"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
theme_override_colors/font_color = Color(0.843137, 0.843137, 0.843137, 1)
theme_override_fonts/font = ExtResource("4_otp86")
theme_override_font_sizes/font_size = 50
text = "1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Directions" type="MarginContainer" parent="HBoxContainer"]
unique_name_in_owner = true
visible = false
custom_minimum_size = Vector2(100, 100)
layout_mode = 2
[node name="Horizontal" type="TextureRect" parent="HBoxContainer/Directions"]
unique_name_in_owner = true
layout_mode = 2
texture = ExtResource("5_81uyo")
stretch_mode = 4
[node name="Vertical" type="TextureRect" parent="HBoxContainer/Directions"]
unique_name_in_owner = true
layout_mode = 2
texture = ExtResource("6_syx8c")
stretch_mode = 4