Move around 2D and GUI demos

This commit is contained in:
Aaron Franke
2020-07-03 20:04:59 -04:00
parent cee39035e3
commit 6b11ca7302
38 changed files with 18 additions and 18 deletions

12
gui/regex/README.md Normal file
View File

@@ -0,0 +1,12 @@
# RegEx (Regular Expressions)
A demo showing regex functionality and usage.
Can also serve as a playground for regex testing.
Language: GDScript
Renderer: GLES 2
## Screenshots
![Screenshot](screenshots/regex.png)

BIN
gui/regex/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

34
gui/regex/icon.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

35
gui/regex/project.godot Normal file
View File

@@ -0,0 +1,35 @@
; 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=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="RegEx (Regular Expressions)"
config/description="A demo showing regex functionality and usage.
Can also serve as a playground for regex testing."
run/main_scene="res://regex.tscn"
config/icon="res://icon.png"
[display]
window/stretch/mode="2d"
window/stretch/aspect="expand"
[gdnative]
singletons=[ ]
[rendering]
quality/driver/driver_name="GLES2"

24
gui/regex/regex.gd Normal file
View File

@@ -0,0 +1,24 @@
extends VBoxContainer
var regex = RegEx.new()
func _ready():
$Text.set_text("They asked me \"What's going on \\\"in the manor\\\"?\"")
update_expression($Expression.text)
func update_expression(text):
regex.compile(text)
update_text()
func update_text():
for child in $List.get_children():
child.queue_free()
if regex.is_valid():
var matches = regex.search($Text.get_text())
if matches != null:
for result in matches.get_strings():
var label = Label.new()
label.text = result
$List.add_child(label)

33
gui/regex/regex.tscn Normal file
View File

@@ -0,0 +1,33 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://regex.gd" type="Script" id=1]
[node name="Regex" type="VBoxContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 14.0
margin_top = 20.0
margin_right = -14.0
margin_bottom = -20.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Expression" type="LineEdit" parent="."]
margin_right = 996.0
margin_bottom = 24.0
text = "\"((?:\\\\.|[^\"])*)\""
[node name="Text" type="TextEdit" parent="."]
margin_top = 28.0
margin_right = 996.0
margin_bottom = 328.0
rect_min_size = Vector2( 0, 300 )
[node name="List" type="VBoxContainer" parent="."]
margin_top = 332.0
margin_right = 996.0
margin_bottom = 332.0
[connection signal="text_changed" from="Expression" to="." method="update_expression"]
[connection signal="text_changed" from="Text" to="." method="update_text"]

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

13
gui/sdf_font/README.md Normal file
View File

@@ -0,0 +1,13 @@
# SDF Font
This is a demo of Signed Distance Field fonts in Godot.
The technique used allows the text to remain clear
under arbitrary zooms and rotations.
Language: GDScript
Renderer: GLES 3 (this effect is not available in GLES 2)
## Screenshots
![Screenshot](screenshots/sdf.png)

BIN
gui/sdf_font/font.font Normal file

Binary file not shown.

BIN
gui/sdf_font/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@@ -0,0 +1,36 @@
; 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=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Signed Distance Field Font Demo"
config/description="This is a demo of Signed Distance Field fonts in Godot.
The technique used allows the text to remain clear
under arbitrary zooms and rotations."
run/main_scene="res://sdf_font_demo.tscn"
config/icon="res://icon.png"
[display]
window/stretch/mode="2d"
window/stretch/aspect="expand"
[gdnative]
singletons=[ ]
[rendering]
environment/default_clear_color=Color( 0.18, 0.1188, 0.15348, 1 )

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@@ -0,0 +1,72 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://font.font" type="BitmapFont" id=1]
[sub_resource type="Animation" id=1]
length = 15.0
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath(".:rect_rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 15 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ 0.0, -360.0 ]
}
[sub_resource type="Animation" id=2]
length = 10.0
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath(".:rect_scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 5 ),
"transitions": PoolRealArray( -2, -2 ),
"update": 0,
"values": [ Vector2( 1, 1 ), Vector2( 7, 7 ) ]
}
[node name="SDFFontDemo" type="CenterContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Base" type="Control" parent="."]
margin_left = 512.0
margin_top = 300.0
margin_right = 512.0
margin_bottom = 300.0
[node name="Rotate" type="AnimationPlayer" parent="Base"]
autoplay = "rotate"
anims/rotate = SubResource( 1 )
anims/zoomin_zoomout = SubResource( 2 )
[node name="Zoom" type="AnimationPlayer" parent="Base"]
autoplay = "zoomin_zoomout"
anims/zoomin_zoomout = SubResource( 2 )
[node name="TextLabel" type="Label" parent="Base"]
margin_left = -128.0
margin_top = -50.0
margin_right = 128.0
margin_bottom = 51.0
custom_fonts/font = ExtResource( 1 )
custom_colors/font_color = Color( 0.853858, 0.771714, 0.753746, 1 )
custom_colors/font_color_shadow = Color( 0.56592, 0.454525, 0.518426, 1 )
text = "Signed Distance
Field Font!!"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}