gd: added input addon
This commit is contained in:
BIN
addons/guide/ui/renderers/touch/icons/touch_1_finger.png
Normal file
BIN
addons/guide/ui/renderers/touch/icons/touch_1_finger.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c5nwnp5cjny7m"
|
||||
path="res://.godot/imported/touch_1_finger.png-c21ed1a6c694f6c9460ef451efcf36e2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/guide/ui/renderers/touch/icons/touch_1_finger.png"
|
||||
dest_files=["res://.godot/imported/touch_1_finger.png-c21ed1a6c694f6c9460ef451efcf36e2.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
|
BIN
addons/guide/ui/renderers/touch/icons/touch_2_fingers.png
Normal file
BIN
addons/guide/ui/renderers/touch/icons/touch_2_fingers.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bllhe78a1yo6"
|
||||
path="res://.godot/imported/touch_2_fingers.png-f5e5340b938b807b9249837228cb3c96.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/guide/ui/renderers/touch/icons/touch_2_fingers.png"
|
||||
dest_files=["res://.godot/imported/touch_2_fingers.png-f5e5340b938b807b9249837228cb3c96.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
|
BIN
addons/guide/ui/renderers/touch/icons/touch_3_fingers.png
Normal file
BIN
addons/guide/ui/renderers/touch/icons/touch_3_fingers.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bwhqf2nmm5q1w"
|
||||
path="res://.godot/imported/touch_3_fingers.png-1b0a5171a90b9f0d4adf18b2d204fed6.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/guide/ui/renderers/touch/icons/touch_3_fingers.png"
|
||||
dest_files=["res://.godot/imported/touch_3_fingers.png-1b0a5171a90b9f0d4adf18b2d204fed6.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
|
BIN
addons/guide/ui/renderers/touch/icons/touch_4_fingers.png
Normal file
BIN
addons/guide/ui/renderers/touch/icons/touch_4_fingers.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.0 KiB |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cjw5m42gufghr"
|
||||
path="res://.godot/imported/touch_4_fingers.png-feb0257c01dc7e2234eb7bd7feabd57d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/guide/ui/renderers/touch/icons/touch_4_fingers.png"
|
||||
dest_files=["res://.godot/imported/touch_4_fingers.png-feb0257c01dc7e2234eb7bd7feabd57d.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
|
BIN
addons/guide/ui/renderers/touch/icons/touch_rotate.png
Normal file
BIN
addons/guide/ui/renderers/touch/icons/touch_rotate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bxj4t5vjx7o3w"
|
||||
path="res://.godot/imported/touch_rotate.png-22fc9d2b74759b3c29981107fa4d935b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/guide/ui/renderers/touch/icons/touch_rotate.png"
|
||||
dest_files=["res://.godot/imported/touch_rotate.png-22fc9d2b74759b3c29981107fa4d935b.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
|
BIN
addons/guide/ui/renderers/touch/icons/touch_zoom.png
Normal file
BIN
addons/guide/ui/renderers/touch/icons/touch_zoom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
34
addons/guide/ui/renderers/touch/icons/touch_zoom.png.import
Normal file
34
addons/guide/ui/renderers/touch/icons/touch_zoom.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cutplj0nhphk"
|
||||
path="res://.godot/imported/touch_zoom.png-6fb619cb5fcce5feede2a4a5f40428ee.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/guide/ui/renderers/touch/icons/touch_zoom.png"
|
||||
dest_files=["res://.godot/imported/touch_zoom.png-6fb619cb5fcce5feede2a4a5f40428ee.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
|
73
addons/guide/ui/renderers/touch/touch_renderer.gd
Normal file
73
addons/guide/ui/renderers/touch/touch_renderer.gd
Normal file
@ -0,0 +1,73 @@
|
||||
@tool
|
||||
extends GUIDEIconRenderer
|
||||
|
||||
const GUIDEInputTouchBase = preload("../../../inputs/guide_input_touch_base.gd")
|
||||
|
||||
@onready var _controls:Control = %Controls
|
||||
@onready var _1_finger:Control = %T1Finger
|
||||
@onready var _2_finger:Control = %T2Fingers
|
||||
@onready var _3_finger:Control = %T3Fingers
|
||||
@onready var _4_finger:Control = %T4Fingers
|
||||
@onready var _rotate:Control = %Rotate
|
||||
@onready var _zoom:Control = %Zoom
|
||||
|
||||
|
||||
@onready var _directions:Control = %Directions
|
||||
@onready var _horizontal:Control = %Horizontal
|
||||
@onready var _vertical:Control = %Vertical
|
||||
@onready var _axis2d:Control = %Axis2D
|
||||
|
||||
|
||||
|
||||
func supports(input:GUIDEInput) -> bool:
|
||||
return input is GUIDEInputTouchAxis1D or \
|
||||
input is GUIDEInputTouchAxis2D or \
|
||||
input is GUIDEInputTouchPosition or \
|
||||
input is GUIDEInputTouchAngle or \
|
||||
input is GUIDEInputTouchDistance
|
||||
|
||||
|
||||
|
||||
func render(input:GUIDEInput) -> void:
|
||||
for child in _controls.get_children():
|
||||
child.visible = false
|
||||
for child in _directions.get_children():
|
||||
child.visible = false
|
||||
|
||||
_directions.visible = false
|
||||
|
||||
if input is GUIDEInputTouchBase:
|
||||
match input.finger_count:
|
||||
2:
|
||||
_2_finger.visible = true
|
||||
3:
|
||||
_3_finger.visible = true
|
||||
4:
|
||||
_4_finger.visible = true
|
||||
_:
|
||||
# we have no icons for more than 4 fingers, so everything else gets
|
||||
# the 1 finger icon
|
||||
_1_finger.visible = true
|
||||
|
||||
if input is GUIDEInputTouchAxis2D:
|
||||
_directions.visible = true
|
||||
_axis2d.visible = true
|
||||
|
||||
if input is GUIDEInputTouchAxis1D:
|
||||
_directions.visible = true
|
||||
match input.axis:
|
||||
GUIDEInputTouchAxis1D.GUIDEInputTouchAxis.X:
|
||||
_horizontal.visible = true
|
||||
GUIDEInputTouchAxis1D.GUIDEInputTouchAxis.X:
|
||||
_vertical.visible = true
|
||||
|
||||
if input is GUIDEInputTouchDistance:
|
||||
_zoom.visible = true
|
||||
|
||||
if input is GUIDEInputTouchAngle:
|
||||
_rotate.visible = true
|
||||
|
||||
call("queue_sort")
|
||||
|
||||
func cache_key(input:GUIDEInput) -> String:
|
||||
return "1f4c5082-d419-465f-aba8-f889caaff335" + input.to_string()
|
1
addons/guide/ui/renderers/touch/touch_renderer.gd.uid
Normal file
1
addons/guide/ui/renderers/touch/touch_renderer.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://birg7gy0a8mom
|
93
addons/guide/ui/renderers/touch/touch_renderer.tscn
Normal file
93
addons/guide/ui/renderers/touch/touch_renderer.tscn
Normal file
@ -0,0 +1,93 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://ykuou1deo5ub"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/guide/ui/renderers/touch/touch_renderer.gd" id="1_heixj"]
|
||||
[ext_resource type="Texture2D" uid="uid://c5nwnp5cjny7m" path="res://addons/guide/ui/renderers/touch/icons/touch_1_finger.png" id="2_4mplc"]
|
||||
[ext_resource type="Texture2D" uid="uid://bllhe78a1yo6" path="res://addons/guide/ui/renderers/touch/icons/touch_2_fingers.png" id="3_0dcqu"]
|
||||
[ext_resource type="Texture2D" uid="uid://bwhqf2nmm5q1w" path="res://addons/guide/ui/renderers/touch/icons/touch_3_fingers.png" id="4_mgq0v"]
|
||||
[ext_resource type="Texture2D" uid="uid://cjw5m42gufghr" path="res://addons/guide/ui/renderers/touch/icons/touch_4_fingers.png" id="5_qoicp"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxj4t5vjx7o3w" path="res://addons/guide/ui/renderers/touch/icons/touch_rotate.png" id="6_4jaqi"]
|
||||
[ext_resource type="Texture2D" uid="uid://cutplj0nhphk" path="res://addons/guide/ui/renderers/touch/icons/touch_zoom.png" id="7_gvy7l"]
|
||||
[ext_resource type="Texture2D" uid="uid://bmgxqbypegjxh" path="res://addons/guide/ui/renderers/textures/arrow_horizontal.svg" id="8_m5om5"]
|
||||
[ext_resource type="Texture2D" uid="uid://dwb1h8sfsccyy" path="res://addons/guide/ui/renderers/textures/arrow_all_directions.svg" id="9_5gr2q"]
|
||||
[ext_resource type="Texture2D" uid="uid://bu5nlug6uf03w" path="res://addons/guide/ui/renderers/textures/arrow_vertical.svg" id="10_4vghq"]
|
||||
|
||||
[node name="TouchRenderer" type="MarginContainer"]
|
||||
offset_right = 100.0
|
||||
offset_bottom = 100.0
|
||||
size_flags_horizontal = 0
|
||||
script = ExtResource("1_heixj")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
|
||||
[node name="Controls" type="MarginContainer" parent="HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(100, 100)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="T1Finger" type="TextureRect" parent="HBoxContainer/Controls"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_4mplc")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="T2Fingers" type="TextureRect" parent="HBoxContainer/Controls"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
texture = ExtResource("3_0dcqu")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="T3Fingers" type="TextureRect" parent="HBoxContainer/Controls"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
texture = ExtResource("4_mgq0v")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="T4Fingers" type="TextureRect" parent="HBoxContainer/Controls"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
texture = ExtResource("5_qoicp")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="Rotate" type="TextureRect" parent="HBoxContainer/Controls"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
texture = ExtResource("6_4jaqi")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="Zoom" type="TextureRect" parent="HBoxContainer/Controls"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
texture = ExtResource("7_gvy7l")
|
||||
stretch_mode = 4
|
||||
|
||||
[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("8_m5om5")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="Vertical" type="TextureRect" parent="HBoxContainer/Directions"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
texture = ExtResource("10_4vghq")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="Axis2D" type="TextureRect" parent="HBoxContainer/Directions"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
texture = ExtResource("9_5gr2q")
|
||||
stretch_mode = 4
|
Reference in New Issue
Block a user