commit e4f0299c0f46082b2fe0dcf96a65fa93a8934769 Author: Anselme FRANÇOIS Date: Wed Dec 17 09:51:20 2025 +0100 initial commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f28239b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +root = true + +[*] +charset = utf-8 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ffa9703 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b9800d6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# Godot 4+ specific ignores +.godot/ +/android/ +.DS_Store +*.tmp \ No newline at end of file diff --git a/OpenSans-Bold.ttf b/OpenSans-Bold.ttf new file mode 100644 index 0000000..9e80d7a --- /dev/null +++ b/OpenSans-Bold.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f4c6f0c6beae94863a099a7a538059c480f91587f1abffc06552e9fa3a44f40 +size 130860 diff --git a/OpenSans-Bold.ttf.import b/OpenSans-Bold.ttf.import new file mode 100644 index 0000000..10d04e4 --- /dev/null +++ b/OpenSans-Bold.ttf.import @@ -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={} diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..c6bbb7d --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..35ddbf4 --- /dev/null +++ b/icon.svg.import @@ -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 diff --git a/main.gd b/main.gd new file mode 100644 index 0000000..e029f7c --- /dev/null +++ b/main.gd @@ -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() diff --git a/main.gd.uid b/main.gd.uid new file mode 100644 index 0000000..f2f764d --- /dev/null +++ b/main.gd.uid @@ -0,0 +1 @@ +uid://drsg3aygmqy4e diff --git a/main.tscn b/main.tscn new file mode 100644 index 0000000..4c9f2fb --- /dev/null +++ b/main.tscn @@ -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 diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..80fbe3e --- /dev/null +++ b/project.godot @@ -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" diff --git a/typed_letter.gd b/typed_letter.gd new file mode 100644 index 0000000..5d95f43 --- /dev/null +++ b/typed_letter.gd @@ -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() diff --git a/typed_letter.gd.uid b/typed_letter.gd.uid new file mode 100644 index 0000000..a570121 --- /dev/null +++ b/typed_letter.gd.uid @@ -0,0 +1 @@ +uid://bk02reogr7lmi diff --git a/typed_letter.tscn b/typed_letter.tscn new file mode 100644 index 0000000..5c19477 --- /dev/null +++ b/typed_letter.tscn @@ -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") +}