initial commit
This commit is contained in:
commit
e4f0299c0f
4
.editorconfig
Normal file
4
.editorconfig
Normal file
@ -0,0 +1,4 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
21
.gitattributes
vendored
Normal file
21
.gitattributes
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Normalize EOL for all files that Git considers text files.
|
||||
* text=auto eol=lf
|
||||
# sound files
|
||||
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
||||
*.aac filter=lfs diff=lfs merge=lfs -text
|
||||
*.flac filter=lfs diff=lfs merge=lfs -text
|
||||
*.m4a filter=lfs diff=lfs merge=lfs -text
|
||||
# image files
|
||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.gif filter=lfs diff=lfs merge=lfs -text
|
||||
*.bmp filter=lfs diff=lfs merge=lfs -text
|
||||
*.tif filter=lfs diff=lfs merge=lfs -text
|
||||
*.tiff filter=lfs diff=lfs merge=lfs -text
|
||||
# 3d model files
|
||||
*.glb filter=lfs diff=lfs merge=lfs -text
|
||||
*.wav filter=lfs diff=lfs merge=lfs -text
|
||||
*.ogg filter=lfs diff=lfs merge=lfs -text
|
||||
# font files
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
/android/
|
||||
.DS_Store
|
||||
*.tmp
|
||||
BIN
OpenSans-Bold.ttf
(Stored with Git LFS)
Normal file
BIN
OpenSans-Bold.ttf
(Stored with Git LFS)
Normal file
Binary file not shown.
42
OpenSans-Bold.ttf.import
Normal file
42
OpenSans-Bold.ttf.import
Normal file
@ -0,0 +1,42 @@
|
||||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://4xh07bbhtmaf"
|
||||
path="res://.godot/imported/OpenSans-Bold.ttf-e736ce5ac4bed0969e44842cb3065dab.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://OpenSans-Bold.ttf"
|
||||
dest_files=["res://.godot/imported/OpenSans-Bold.ttf-e736ce5ac4bed0969e44842cb3065dab.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
|
||||
modulate_color_glyphs=false
|
||||
hinting=1
|
||||
subpixel_positioning=4
|
||||
keep_rounding_remainders=true
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[{
|
||||
"chars": [90, 70, 68, 74, 71, 75, 78, 82, 79, 83, 86, 87, 89, 88, 81, 85, 84, 67, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 80, 77, 76, 73, 72, 69, 66, 65, 0, 13, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 58, 59, 60, 61, 62, 63, 64, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255],
|
||||
"glyphs": [],
|
||||
"name": "New Configuration",
|
||||
&"size": Vector2i(100, 0),
|
||||
&"variation_embolden": 0.0
|
||||
}]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
||||
1
icon.svg
Normal file
1
icon.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" 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"/><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" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>
|
||||
|
After Width: | Height: | Size: 995 B |
43
icon.svg.import
Normal file
43
icon.svg.import
Normal file
@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c4x58roxqr6u"
|
||||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.svg"
|
||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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
|
||||
56
main.gd
Normal file
56
main.gd
Normal file
@ -0,0 +1,56 @@
|
||||
extends Control
|
||||
|
||||
const SCREEN_HEIGHT: int = 768
|
||||
const LINE_HEIGHT: int = 150
|
||||
const LETTER_SPACING: int = 20
|
||||
|
||||
var label: Resource = preload("res://typed_letter.tscn")
|
||||
var labels: Array = []
|
||||
var current_x: float = 0
|
||||
var current_y: float = 0
|
||||
|
||||
@onready var labels_node: Control = $Labels
|
||||
|
||||
func _ready() -> void:
|
||||
offset_line(1)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event is InputEventKey:
|
||||
var key_event: InputEventKey = event
|
||||
if key_event.pressed and not key_event.echo:
|
||||
var letter: String = OS.get_keycode_string(event.keycode)
|
||||
if letter.length() == 1:
|
||||
spawn_text(OS.get_keycode_string(event.keycode))
|
||||
# label.text = label.text + OS.get_keycode_string(event.keycode)
|
||||
else:
|
||||
match key_event.keycode:
|
||||
Key.KEY_ENTER:
|
||||
offset_line()
|
||||
Key.KEY_ESCAPE:
|
||||
offset_line(6)
|
||||
Key.KEY_BACKSPACE:
|
||||
delete_last_text()
|
||||
|
||||
func offset_line(amount: int = 1) -> void:
|
||||
current_x = 0
|
||||
current_y = current_y + LINE_HEIGHT * amount
|
||||
var target_pos := Vector2(0, SCREEN_HEIGHT - (LINE_HEIGHT + current_y))
|
||||
var tween := get_tree().create_tween()
|
||||
var tweener := tween.tween_property(labels_node, "position", target_pos, 0.4)
|
||||
tweener.from_current().set_trans(Tween.TRANS_CUBIC)
|
||||
|
||||
func spawn_text(text: String) -> void:
|
||||
var instance : TypedLetter = label.instantiate()
|
||||
labels.push_back(instance)
|
||||
labels_node.add_child(instance)
|
||||
instance.position = Vector2(current_x, current_y)
|
||||
instance.add_label(text)
|
||||
current_x = current_x + instance.get_width() + LETTER_SPACING
|
||||
|
||||
func delete_last_text() -> void:
|
||||
if not labels.is_empty():
|
||||
var last: TypedLetter = labels.back()
|
||||
if current_y == last.position.y:
|
||||
current_x = last.position.x
|
||||
labels.pop_back()
|
||||
last.delete_label()
|
||||
1
main.gd.uid
Normal file
1
main.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://drsg3aygmqy4e
|
||||
45
main.tscn
Normal file
45
main.tscn
Normal file
@ -0,0 +1,45 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dtgl0v3ev3l1o"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://drsg3aygmqy4e" path="res://main.gd" id="1_0xm2m"]
|
||||
[ext_resource type="FontFile" uid="uid://4xh07bbhtmaf" path="res://OpenSans-Bold.ttf" id="1_ig7tw"]
|
||||
|
||||
[sub_resource type="FontVariation" id="FontVariation_0xm2m"]
|
||||
base_font = ExtResource("1_ig7tw")
|
||||
spacing_glyph = 2
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_0xm2m")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_top = 0
|
||||
theme_override_constants/margin_right = 20
|
||||
theme_override_constants/margin_bottom = 0
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_fonts/normal_font = SubResource("FontVariation_0xm2m")
|
||||
theme_override_font_sizes/normal_font_size = 120
|
||||
theme_override_font_sizes/bold_font_size = 16
|
||||
theme_override_font_sizes/bold_italics_font_size = 16
|
||||
theme_override_font_sizes/italics_font_size = 16
|
||||
theme_override_font_sizes/mono_font_size = 16
|
||||
autowrap_mode = 1
|
||||
text_direction = 1
|
||||
|
||||
[node name="Labels" type="Control" parent="."]
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
28
project.godot
Normal file
28
project.godot
Normal file
@ -0,0 +1,28 @@
|
||||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
|
||||
[application]
|
||||
|
||||
config/name="AgatheOS"
|
||||
run/main_scene="uid://dtgl0v3ev3l1o"
|
||||
config/features=PackedStringArray("4.5", "GL Compatibility")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=1024
|
||||
window/size/viewport_height=768
|
||||
window/size/resizable=false
|
||||
window/size/borderless=true
|
||||
|
||||
[rendering]
|
||||
|
||||
renderer/rendering_method="gl_compatibility"
|
||||
renderer/rendering_method.mobile="gl_compatibility"
|
||||
25
typed_letter.gd
Normal file
25
typed_letter.gd
Normal file
@ -0,0 +1,25 @@
|
||||
class_name TypedLetter
|
||||
extends Control
|
||||
|
||||
# https://freesound.org/people/edschaefer/sounds/343097/
|
||||
|
||||
@onready var label: Label = $Label
|
||||
|
||||
var letter_size := Vector2.ZERO
|
||||
|
||||
func _ready() ->void:
|
||||
pass
|
||||
|
||||
func get_width() -> float:
|
||||
return letter_size.x
|
||||
|
||||
func add_label(text: String) -> void:
|
||||
label.text = text
|
||||
letter_size = label.get_theme_font("font").get_string_size(label.text, HORIZONTAL_ALIGNMENT_LEFT, -1, label.get_theme_font_size("font_size"))
|
||||
label.pivot_offset = letter_size / 2
|
||||
$AnimationPlayer.play("spawn")
|
||||
|
||||
func delete_label() -> void:
|
||||
|
||||
# todo => delete letter animation
|
||||
queue_free()
|
||||
1
typed_letter.gd.uid
Normal file
1
typed_letter.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://bk02reogr7lmi
|
||||
86
typed_letter.tscn
Normal file
86
typed_letter.tscn
Normal file
@ -0,0 +1,86 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://badfkx2cegbbh"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bk02reogr7lmi" path="res://typed_letter.gd" id="1_382cc"]
|
||||
[ext_resource type="FontFile" uid="uid://4xh07bbhtmaf" path="res://OpenSans-Bold.ttf" id="2_s3pwu"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_i3osk"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Label:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Label:theme_override_colors/font_color")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_06tve"]
|
||||
resource_name = "spawn"
|
||||
length = 0.2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Label:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.13333334, 0.2),
|
||||
"transitions": PackedFloat32Array(5.4641523, 0.28717464, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.4, 0.4), Vector2(1.2, 1.2), Vector2(1, 1)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Label:theme_override_colors/font_color")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.13333334),
|
||||
"transitions": PackedFloat32Array(5.4641523, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_02dvo"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_i3osk"),
|
||||
&"spawn": SubResource("Animation_06tve")
|
||||
}
|
||||
|
||||
[node name="Root" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 70.0
|
||||
offset_bottom = 165.0
|
||||
script = ExtResource("1_382cc")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 23.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_fonts/font = ExtResource("2_s3pwu")
|
||||
theme_override_font_sizes/font_size = 100
|
||||
text = "T"
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_02dvo")
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user