add basic overlay for fps and time (not zero padded)

This commit is contained in:
Crispy 2021-05-16 00:35:26 +02:00
parent a2aae82364
commit 9ac2b7ec24
21 changed files with 336 additions and 15 deletions

View file

@ -0,0 +1,21 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://icon.png" type="Texture" id=1]
[node name="Overlay" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TextureRect" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 1 )
expand = true
__meta__ = {
"_edit_use_anchors_": false
}

View file

@ -0,0 +1,49 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://overlays/fps.gd" type="Script" id=1]
[ext_resource path="res://fonts/OpenSans-Regular.ttf" type="DynamicFontData" id=2]
[sub_resource type="DynamicFont" id=1]
size = 48
font_data = ExtResource( 2 )
[node name="Overlay" type="Control"]
modulate = Color( 1, 1, 1, 0.490196 )
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ColorRect" type="ColorRect" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -222.0
margin_top = -32.0
margin_right = 222.0
margin_bottom = 32.0
color = Color( 0, 0, 0, 0.392157 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="ColorRect"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -512.0
margin_top = -33.5
margin_right = 512.0
margin_bottom = 33.5
custom_fonts/font = SubResource( 1 )
text = "Overlay FPS: 60"
align = 1
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

View file

@ -0,0 +1,48 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://overlays/time.gd" type="Script" id=1]
[ext_resource path="res://fonts/OpenSans-Regular.ttf" type="DynamicFontData" id=2]
[sub_resource type="DynamicFont" id=1]
size = 48
font_data = ExtResource( 2 )
[node name="Overlay" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ColorRect" type="ColorRect" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -222.0
margin_top = -32.0
margin_right = 222.0
margin_bottom = 32.0
color = Color( 0, 0, 0, 0.705882 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="ColorRect"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -512.0
margin_top = -33.5
margin_right = 512.0
margin_bottom = 33.5
custom_fonts/font = SubResource( 1 )
text = "00:00"
align = 1
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

View file

@ -0,0 +1,9 @@
extends Label
func _ready() -> void:
pass
func _process(delta: float) -> void:
if delta > 0:
text = "Overlay FPS: " + str(round(1/delta))

View file

@ -0,0 +1,8 @@
extends Label
func _ready() -> void:
pass
func _process(delta: float) -> void:
text = "%s:%s" % [OS.get_time().hour, OS.get_time().minute]