summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrom <romangraef@gmail.com>2021-04-25 00:48:50 +0200
committerrom <romangraef@gmail.com>2021-04-25 00:49:01 +0200
commite1f67cda480d596c8d52d6c0d666e40297cc70fa (patch)
tree8c3159afb42c8cdfd956514dc728ebee340d68f2
parent66a83b84af05256c468f4cc47545ce592a9353fc (diff)
downloadldjam48-e1f67cda480d596c8d52d6c0d666e40297cc70fa.tar.gz
ldjam48-e1f67cda480d596c8d52d6c0d666e40297cc70fa.tar.bz2
ldjam48-e1f67cda480d596c8d52d6c0d666e40297cc70fa.zip
centralize fonts and make textreveal a node
-rw-r--r--components/button.gd4
-rw-r--r--components/button.tscn27
-rw-r--r--components/textreveal.gd24
-rw-r--r--components/textreveal.tscn18
-rw-r--r--fonts/Flipps.tres8
-rw-r--r--fonts/Flipps_Theme.tres6
-rw-r--r--project.godot8
-rw-r--r--scenes/introduction.gd5
-rw-r--r--scenes/introduction.tscn24
9 files changed, 53 insertions, 71 deletions
diff --git a/components/button.gd b/components/button.gd
index 1171cbd..f5f1606 100644
--- a/components/button.gd
+++ b/components/button.gd
@@ -15,11 +15,11 @@ var is_hovered = false
onready var stretcher : Node2D = $Middle
onready var left : Node2D = $Left
onready var right : Node2D = $Right
-onready var font_source : RichTextLabel = $FontSource
onready var hitbox : CollisionShape2D = $Hitbox
const BASE_WIDTH = 6
const BASE_HEIGHT = 16
+const theme : Theme = preload("res://fonts/Flipps_Theme.tres")
const left_nohover = preload("res://textures/components/button/left.png")
const left_hover = preload("res://textures/components/button/left_hover.png")
const left_press = preload("res://textures/components/button/left_press.png")
@@ -35,7 +35,7 @@ var label
func _ready():
label = Label.new()
label.text = text
- label.theme = font_source.theme
+ label.theme = theme
add_child(label)
label.rect_position = -label.rect_size / 2
var width = label.rect_size.x
diff --git a/components/button.tscn b/components/button.tscn
index 6248b45..0fda370 100644
--- a/components/button.tscn
+++ b/components/button.tscn
@@ -1,19 +1,11 @@
-[gd_scene load_steps=9 format=2]
+[gd_scene load_steps=6 format=2]
[ext_resource path="res://textures/components/button/middle.png" type="Texture" id=1]
[ext_resource path="res://textures/components/button/right.png" type="Texture" id=2]
-[ext_resource path="res://fonts/Fipps-Regular.otf" type="DynamicFontData" id=3]
[ext_resource path="res://textures/components/button/left.png" type="Texture" id=4]
[ext_resource path="res://components/button.gd" type="Script" id=5]
-[sub_resource type="DynamicFont" id=1]
-outline_color = Color( 0, 0, 0, 1 )
-font_data = ExtResource( 3 )
-
-[sub_resource type="Theme" id=2]
-default_font = SubResource( 1 )
-
-[sub_resource type="RectangleShape2D" id=3]
+[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 10, 32 )
[node name="Button" type="Area2D"]
@@ -34,20 +26,9 @@ position = Vector2( -0.5, 0 )
scale = Vector2( 30.321, 4 )
texture = ExtResource( 1 )
-[node name="FontSource" type="RichTextLabel" parent="."]
-grow_horizontal = 2
-grow_vertical = 2
-rect_clip_content = false
-size_flags_horizontal = 3
-theme = SubResource( 2 )
-text = "Menu"
-scroll_active = false
-__meta__ = {
-"_edit_use_anchors_": false
-}
-
[node name="Hitbox" type="CollisionShape2D" parent="."]
-shape = SubResource( 3 )
+shape = SubResource( 1 )
+
[connection signal="input_event" from="." to="." method="_on_ButtonTest_input_event"]
[connection signal="mouse_entered" from="." to="." method="_on_ButtonTest_mouse_entered"]
[connection signal="mouse_exited" from="." to="." method="_on_ButtonTest_mouse_exited"]
diff --git a/components/textreveal.gd b/components/textreveal.gd
index 1685a8d..d76282a 100644
--- a/components/textreveal.gd
+++ b/components/textreveal.gd
@@ -1,8 +1,9 @@
-extends Node2D
+extends Label
+class_name TextReveal
signal finished_reveal()
-export(String, MULTILINE) var text = "Text"
+export(String, MULTILINE) var to_render = "Text"
export var speed = 100.0
############
@@ -10,23 +11,15 @@ export var speed = 100.0
############
-onready var font_source : RichTextLabel = $FontSource
var revealed = 0
var started = false
var finished = false
var t = 0
-onready var label = Label.new()
# Called when the node enters the scene tree for the first time.
func _ready():
- label.theme = font_source.theme
- label.align = Label.ALIGN_CENTER
- add_child(label)
-
-
-func _show_text(text):
- label.text = text
- label.rect_position = -label.rect_size / 2
+ theme = preload("res://fonts/Flipps_Theme.tres")
+ align = Label.ALIGN_CENTER
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
@@ -36,15 +29,16 @@ func _process(delta):
var additional = int(t)
t -= additional
revealed += additional
- _show_text(text.substr(0, revealed))
- if text.length() == revealed:
+ text = to_render.substr(0, revealed)
+ rect_position = -rect_size / 2
+ if to_render.length() == revealed:
started = false
finished = true
emit_signal("finished_reveal")
func start():
started = true
- label.text = ""
+ text = ""
revealed = 0
t = 0
finished = false
diff --git a/components/textreveal.tscn b/components/textreveal.tscn
index a6d9cbb..455bb49 100644
--- a/components/textreveal.tscn
+++ b/components/textreveal.tscn
@@ -1,22 +1,6 @@
-[gd_scene load_steps=5 format=2]
+[gd_scene load_steps=2 format=2]
[ext_resource path="res://components/textreveal.gd" type="Script" id=1]
-[ext_resource path="res://fonts/Fipps-Regular.otf" type="DynamicFontData" id=2]
-
-[sub_resource type="DynamicFont" id=1]
-font_data = ExtResource( 2 )
-
-[sub_resource type="Theme" id=2]
-default_font = SubResource( 1 )
[node name="Node2D" type="Node2D"]
script = ExtResource( 1 )
-
-[node name="FontSource" type="RichTextLabel" parent="."]
-grow_horizontal = 2
-grow_vertical = 2
-theme = SubResource( 2 )
-text = "AAAAAAAAAAAAAAAAAAAAAAA"
-__meta__ = {
-"_edit_use_anchors_": false
-}
diff --git a/fonts/Flipps.tres b/fonts/Flipps.tres
new file mode 100644
index 0000000..d177109
--- /dev/null
+++ b/fonts/Flipps.tres
@@ -0,0 +1,8 @@
+[gd_resource type="DynamicFont" load_steps=2 format=2]
+
+[ext_resource path="res://fonts/Fipps-Regular.otf" type="DynamicFontData" id=1]
+
+[resource]
+outline_size = 2
+outline_color = Color( 0, 0, 0, 1 )
+font_data = ExtResource( 1 )
diff --git a/fonts/Flipps_Theme.tres b/fonts/Flipps_Theme.tres
new file mode 100644
index 0000000..5a3dd80
--- /dev/null
+++ b/fonts/Flipps_Theme.tres
@@ -0,0 +1,6 @@
+[gd_resource type="Theme" load_steps=2 format=2]
+
+[ext_resource path="res://fonts/Flipps.tres" type="DynamicFont" id=1]
+
+[resource]
+default_font = ExtResource( 1 )
diff --git a/project.godot b/project.godot
index e6178fd..4c5983b 100644
--- a/project.godot
+++ b/project.godot
@@ -13,9 +13,15 @@ _global_script_classes=[ {
"class": "ButtonTest",
"language": "GDScript",
"path": "res://components/button.gd"
+}, {
+"base": "Label",
+"class": "TextReveal",
+"language": "GDScript",
+"path": "res://components/textreveal.gd"
} ]
_global_script_class_icons={
-"ButtonTest": ""
+"ButtonTest": "",
+"TextReveal": ""
}
[application]
diff --git a/scenes/introduction.gd b/scenes/introduction.gd
index 8c4f525..7db2651 100644
--- a/scenes/introduction.gd
+++ b/scenes/introduction.gd
@@ -1,11 +1,8 @@
extends Node
-onready var textreveal = $Textreveal
+onready var textreveal = $TextReveal
# Called when the node enters the scene tree for the first time.
func _ready():
textreveal.start()
-
-func _on_Textreveal_finished_reveal():
- print("Done")
diff --git a/scenes/introduction.tscn b/scenes/introduction.tscn
index f36644a..460ced3 100644
--- a/scenes/introduction.tscn
+++ b/scenes/introduction.tscn
@@ -1,16 +1,22 @@
[gd_scene load_steps=3 format=2]
-[ext_resource path="res://components/textreveal.tscn" type="PackedScene" id=1]
+[ext_resource path="res://components/textreveal.gd" type="Script" id=1]
[ext_resource path="res://scenes/introduction.gd" type="Script" id=2]
[node name="CanvasLayer" type="Node2D"]
+position = Vector2( 654.009, 325.417 )
script = ExtResource( 2 )
-[node name="Textreveal" parent="." instance=ExtResource( 1 )]
-position = Vector2( 639.655, 256.718 )
-text = "Long long time ago
-i fucked your mom
-lmao jk, meant your dad"
-speed = 10.0
-
-[connection signal="finished_reveal" from="Textreveal" to="." method="_on_Textreveal_finished_reveal"]
+[node name="TextReveal" type="Label" parent="."]
+margin_left = 715.918
+margin_top = 322.242
+margin_right = 755.918
+margin_bottom = 336.242
+script = ExtResource( 1 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
+to_render = "AHAHAHAHHAHAHA
+Cock and ball torture (CBT), occasionally known as penis torture,
+dick torture or male genitorture, is a sexual activity involving application
+of pain or constriction to the penis or testicles. "