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

View File

@ -0,0 +1,13 @@
extends Node2D
@export var speed:float = 600
var direction:Vector2 = Vector2.ZERO
func _ready():
await get_tree().create_timer(5).timeout
queue_free()
func _process(delta):
position += speed * direction * delta

View File

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

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 128 128" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;">
<g transform="matrix(1.16646,0,0,1.34183,-11.9495,-38.5658)">
<path d="M64.679,36.838L66.447,54.571L70.104,44.326L69.94,55.052L77.925,38.662L73.303,56.002L80.423,47.24L76.454,57.397L89.874,43.955L79.315,59.204L89.2,52.784L81.815,61.378L99.357,52.198L83.894,63.865L95.578,60.415L85.499,66.604L105.446,62.586L86.592,69.528L98.93,69.385L87.145,72.564L107.544,74.101L87.145,75.638L98.93,78.817L86.592,78.674L105.446,85.616L85.499,81.598L95.578,87.787L83.894,84.337L99.357,96.003L81.815,86.824L89.2,95.417L79.315,88.997L89.874,104.247L76.454,90.804L80.423,100.961L73.303,92.2L77.925,109.54L69.94,93.15L70.104,103.876L66.447,93.631L64.679,111.363L62.911,93.631L59.254,103.876L59.418,93.15L51.433,109.54L56.055,92.2L48.935,100.961L52.904,90.804L39.484,104.247L50.044,88.997L40.158,95.417L47.543,86.824L30.001,96.003L45.465,84.337L33.78,87.787L43.859,81.598L23.912,85.616L42.766,78.674L30.428,78.817L42.213,75.638L21.814,74.101L42.213,72.564L30.428,69.385L42.766,69.528L23.912,62.586L43.859,66.604L33.78,60.415L45.465,63.865L30.001,52.198L47.543,61.378L40.158,52.784L50.044,59.204L39.484,43.955L52.904,57.397L48.935,47.24L56.055,56.002L51.433,38.662L59.418,55.052L59.254,44.326L62.911,54.571L64.679,36.838Z" style="fill:rgb(255,208,0);stroke:rgb(200,163,0);stroke-width:0.8px;"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://buu21kg4kkhiw"
path="res://.godot/imported/fireball.svg-da8480a7a8e47ac511e0971f6fa164bd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://guide_examples/shared/fireball/fireball.svg"
dest_files=["res://.godot/imported/fireball.svg-da8480a7a8e47ac511e0971f6fa164bd.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View File

@ -0,0 +1,10 @@
[gd_scene load_steps=3 format=3 uid="uid://c36cnvgv2ur60"]
[ext_resource type="Script" path="res://guide_examples/shared/fireball/fireball.gd" id="1_jxcno"]
[ext_resource type="Texture2D" uid="uid://buu21kg4kkhiw" path="res://guide_examples/shared/fireball/fireball.svg" id="2_5ckxn"]
[node name="Fireball" type="Node2D"]
script = ExtResource("1_jxcno")
[node name="Fireball" type="Sprite2D" parent="."]
texture = ExtResource("2_5ckxn")

View File

@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z" fill="#478cbf"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>

After

Width:  |  Height:  |  Size: 949 B

View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://byjxtsekdl8t2"
path="res://.godot/imported/godot_logo.svg-ce7d52346b74cfa0766735b0b77afab9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://guide_examples/shared/godot_logo.svg"
dest_files=["res://.godot/imported/godot_logo.svg-ce7d52346b74cfa0766735b0b77afab9.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View File

@ -0,0 +1,52 @@
## This is an example for how input prompts can be shown to the player.
extends RichTextLabel
## The instructions text. Should contain %s where the action text should go.
@export_multiline var instructions_text:String
## The actions which should be used for rendering the instructions. One action for
## each %s in the text.
@export var actions:Array[GUIDEAction] = []
## The icon size to be used for rendering.
@export var icon_size:int = 48
## If set, the label will only show when the given mapping context is active.
@export var limit_to_context:GUIDEMappingContext
# The formatter. This will do the actual work of formatting action inputs into prompts.
var _formatter:GUIDEInputFormatter
func _ready():
bbcode_enabled = true
fit_content = true
scroll_active = false
autowrap_mode = TextServer.AUTOWRAP_OFF
# Subscribe to the input mappings change so we can update the prompts or hide the label
# when any inputs change. This way the label can automatically update itself if we switch
# from keyboard to controller input or rebind some keys.
GUIDE.input_mappings_changed.connect(_update_instructions)
_formatter = GUIDEInputFormatter.for_active_contexts(icon_size)
func _update_instructions():
# If we only show for a certain context, hide if that context isn't active right now.
if limit_to_context != null and not GUIDE.is_mapping_context_enabled(limit_to_context):
visible = false
return
# if no mapping context is active, we'll not be able to show instructions, so bail out here.
if GUIDE.get_enabled_mapping_contexts().is_empty():
visible = false
return
visible = true
# Update the prompts.
var replacements:Array[String] = []
for action in actions:
replacements.append(await _formatter.action_as_richtext_async(action))
parse_bbcode(instructions_text % replacements)

View File

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

View File

@ -0,0 +1,5 @@
[gd_resource type="Theme" format=3 uid="uid://dot0gi1yoqmrl"]
[resource]
default_font_size = 24
HeaderLarge/font_sizes/font_size = 30