gd: added input addon
This commit is contained in:
BIN
addons/guide/ui/renderers/keyboard/Lato-Black.ttf
Normal file
BIN
addons/guide/ui/renderers/keyboard/Lato-Black.ttf
Normal file
Binary file not shown.
35
addons/guide/ui/renderers/keyboard/Lato-Black.ttf.import
Normal file
35
addons/guide/ui/renderers/keyboard/Lato-Black.ttf.import
Normal file
@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://cu8bvod6tnnwr"
|
||||
path="res://.godot/imported/Lato-Black.ttf-dd70fb4540a062e6fd25f6b3cb73f785.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/guide/ui/renderers/keyboard/Lato-Black.ttf"
|
||||
dest_files=["res://.godot/imported/Lato-Black.ttf-dd70fb4540a062e6fd25f6b3cb73f785.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
keep_rounding_remainders=true
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
addons/guide/ui/renderers/keyboard/icons/Blank_White_Normal.png
Normal file
BIN
addons/guide/ui/renderers/keyboard/icons/Blank_White_Normal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b3x586os8uuwb"
|
||||
path="res://.godot/imported/Blank_White_Normal.png-71b5933a92dfdd83fd323e35be33b3b2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/guide/ui/renderers/keyboard/icons/Blank_White_Normal.png"
|
||||
dest_files=["res://.godot/imported/Blank_White_Normal.png-71b5933a92dfdd83fd323e35be33b3b2.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
|
17
addons/guide/ui/renderers/keyboard/key_renderer.gd
Normal file
17
addons/guide/ui/renderers/keyboard/key_renderer.gd
Normal file
@ -0,0 +1,17 @@
|
||||
@tool
|
||||
extends GUIDEIconRenderer
|
||||
|
||||
@onready var _label:Label = %Label
|
||||
|
||||
func supports(input:GUIDEInput) -> bool:
|
||||
return input is GUIDEInputKey
|
||||
|
||||
func render(input:GUIDEInput) -> void:
|
||||
var key:Key = input.key
|
||||
var label_key:Key = DisplayServer.keyboard_get_label_from_physical(key)
|
||||
_label.text = OS.get_keycode_string(label_key).strip_edges()
|
||||
size = Vector2.ZERO
|
||||
call("queue_sort")
|
||||
|
||||
func cache_key(input:GUIDEInput) -> String:
|
||||
return "ed6923d5-4115-44bd-b35e-2c4102ffc83e" + input.to_string()
|
1
addons/guide/ui/renderers/keyboard/key_renderer.gd.uid
Normal file
1
addons/guide/ui/renderers/keyboard/key_renderer.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://cd4r6x5q0mkhp
|
36
addons/guide/ui/renderers/keyboard/key_renderer.tscn
Normal file
36
addons/guide/ui/renderers/keyboard/key_renderer.tscn
Normal file
@ -0,0 +1,36 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://toty2e3yx26l"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/guide/ui/renderers/keyboard/key_renderer.gd" id="1_tm2sd"]
|
||||
[ext_resource type="Texture2D" uid="uid://b3x586os8uuwb" path="res://addons/guide/ui/renderers/keyboard/icons/Blank_White_Normal.png" id="2_myc15"]
|
||||
[ext_resource type="FontFile" uid="uid://cu8bvod6tnnwr" path="res://addons/guide/ui/renderers/keyboard/Lato-Black.ttf" id="3_d3uds"]
|
||||
|
||||
[node name="KeyRenderer" type="MarginContainer"]
|
||||
custom_minimum_size = Vector2(100, 100)
|
||||
offset_right = 267.0
|
||||
offset_bottom = 100.0
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
script = ExtResource("1_tm2sd")
|
||||
|
||||
[node name="NinePatchRect" type="NinePatchRect" parent="."]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_myc15")
|
||||
region_rect = Rect2(10, 10, 80, 80)
|
||||
patch_margin_left = 29
|
||||
patch_margin_top = 30
|
||||
patch_margin_right = 29
|
||||
patch_margin_bottom = 29
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 30
|
||||
theme_override_constants/margin_right = 30
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.25098, 0.25098, 0.25098, 1)
|
||||
theme_override_fonts/font = ExtResource("3_d3uds")
|
||||
theme_override_font_sizes/font_size = 45
|
||||
text = "Long Long Long"
|
||||
horizontal_alignment = 1
|
Reference in New Issue
Block a user