mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2025-12-16 13:30:07 +01:00
Convert demos to Godot 4 using regular expressions in a script
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using Godot;
|
||||
|
||||
public class MonoTest : Node
|
||||
public partial class MonoTest : Node
|
||||
{
|
||||
public string OperatingSystem()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Godot.NET.Sdk/3.3.0">
|
||||
<Project Sdk="Godot.NET.Sdk/4.0.0-dev5">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<RootNamespace>OperatingSystemTesting</RootNamespace>
|
||||
|
||||
@@ -27,7 +27,7 @@ func _on_ChangeWindowIcon_pressed():
|
||||
|
||||
func _on_MoveWindowToForeground_pressed():
|
||||
OS.set_window_title("Will move window to foreground in 5 seconds, try unfocusing the window...")
|
||||
yield(get_tree().create_timer(5), "timeout")
|
||||
await get_tree().create_timer(5).timeout
|
||||
OS.move_window_to_foreground()
|
||||
# Restore the previous window title.
|
||||
OS.set_window_title(ProjectSettings.get_setting("application/config/name"))
|
||||
@@ -35,7 +35,7 @@ func _on_MoveWindowToForeground_pressed():
|
||||
|
||||
func _on_RequestAttention_pressed():
|
||||
OS.set_window_title("Will request attention in 5 seconds, try unfocusing the window...")
|
||||
yield(get_tree().create_timer(5), "timeout")
|
||||
await get_tree().create_timer(5).timeout
|
||||
OS.request_attention()
|
||||
# Restore the previous window title.
|
||||
OS.set_window_title(ProjectSettings.get_setting("application/config/name"))
|
||||
@@ -50,7 +50,7 @@ func _on_VibrateDeviceLong_pressed():
|
||||
|
||||
|
||||
func _on_AddGlobalMenuItems_pressed():
|
||||
OS.global_menu_add_item("Hello", "World", 0, null)
|
||||
OS.global_menu_add_item("Hello", "World3D", 0, null)
|
||||
OS.global_menu_add_separator("Hello")
|
||||
OS.global_menu_add_item("Hello2", "World2", 0, null)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
type="StreamTexture2D"
|
||||
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -10,25 +10,25 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
||||
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/hdr_compression=1
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
compress/channel_pack=0
|
||||
compress/streamed=false
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
extends Node
|
||||
|
||||
onready var rtl = $HBoxContainer/Features
|
||||
onready var mono_test = $MonoTest
|
||||
@onready var rtl = $HBoxContainer/Features
|
||||
@onready var mono_test = $MonoTest
|
||||
|
||||
|
||||
# Returns a human-readable string from a date and time, date, or time dictionary.
|
||||
@@ -61,7 +61,7 @@ func add_line(key, value):
|
||||
|
||||
func _ready():
|
||||
add_header("Audio")
|
||||
var audio_drivers = PoolStringArray()
|
||||
var audio_drivers = PackedStringArray()
|
||||
for i in OS.get_audio_driver_count():
|
||||
audio_drivers.push_back(OS.get_audio_driver_name(i))
|
||||
add_line("Available drivers", audio_drivers.join(", "))
|
||||
@@ -110,8 +110,8 @@ func _ready():
|
||||
add_line("Model name", OS.get_model_name())
|
||||
add_line("Processor count", OS.get_processor_count())
|
||||
add_line("Device unique ID", OS.get_unique_id())
|
||||
add_line("Video adapter name", VisualServer.get_video_adapter_name())
|
||||
add_line("Video adapter vendor", VisualServer.get_video_adapter_vendor())
|
||||
add_line("Video adapter name", RenderingServer.get_video_adapter_name())
|
||||
add_line("Video adapter vendor", RenderingServer.get_video_adapter_vendor())
|
||||
|
||||
add_header("Input")
|
||||
add_line("Latin keyboard variant", OS.get_latin_keyboard_variant())
|
||||
@@ -148,7 +148,7 @@ func _ready():
|
||||
add_line("Ringtones", OS.get_system_dir(OS.SYSTEM_DIR_RINGTONES))
|
||||
|
||||
add_header("Video")
|
||||
var video_drivers = PoolStringArray()
|
||||
var video_drivers = PackedStringArray()
|
||||
for i in OS.get_video_driver_count():
|
||||
video_drivers.push_back(OS.get_video_driver_name(i))
|
||||
add_line("Available drivers", video_drivers.join(", "))
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://os_test.gd" type="Script" id=1]
|
||||
[ext_resource path="res://noto_sans_ui_bold.ttf" type="DynamicFontData" id=2]
|
||||
[ext_resource path="res://noto_sans_ui_regular.ttf" type="DynamicFontData" id=3]
|
||||
[ext_resource path="res://noto_sans_ui_bold.ttf" type="FontData" id=2]
|
||||
[ext_resource path="res://noto_sans_ui_regular.ttf" type="FontData" id=3]
|
||||
[ext_resource path="res://actions.gd" type="Script" id=4]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
[sub_resource type="Font" id=1]
|
||||
size = 14
|
||||
font_data = ExtResource( 3 )
|
||||
|
||||
[sub_resource type="Theme" id=2]
|
||||
default_font = SubResource( 1 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=3]
|
||||
[sub_resource type="Font" id=3]
|
||||
size = 14
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
@@ -28,18 +28,18 @@ __meta__ = {
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 20.0
|
||||
margin_top = 20.0
|
||||
margin_right = -20.0
|
||||
margin_bottom = -20.0
|
||||
offset_left = 20.0
|
||||
offset_top = 20.0
|
||||
offset_right = -20.0
|
||||
offset_bottom = -20.0
|
||||
custom_constants/separation = 20
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Features" type="RichTextLabel" parent="HBoxContainer"]
|
||||
margin_right = 482.0
|
||||
margin_bottom = 560.0
|
||||
offset_right = 482.0
|
||||
offset_bottom = 560.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
custom_constants/line_separation = 4
|
||||
@@ -51,17 +51,17 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="Actions" type="VBoxContainer" parent="HBoxContainer"]
|
||||
margin_left = 502.0
|
||||
margin_right = 984.0
|
||||
margin_bottom = 560.0
|
||||
offset_left = 502.0
|
||||
offset_right = 984.0
|
||||
offset_bottom = 560.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
custom_constants/separation = 20
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxContainer/Actions"]
|
||||
margin_right = 482.0
|
||||
margin_bottom = 20.0
|
||||
offset_right = 482.0
|
||||
offset_bottom = 20.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "Actions"
|
||||
align = 1
|
||||
@@ -70,9 +70,9 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="HBoxContainer/Actions"]
|
||||
margin_top = 40.0
|
||||
margin_right = 482.0
|
||||
margin_bottom = 560.0
|
||||
offset_top = 40.0
|
||||
offset_right = 482.0
|
||||
offset_bottom = 560.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
columns = 2
|
||||
@@ -81,118 +81,118 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="OpenShellWeb" type="Button" parent="HBoxContainer/Actions/GridContainer"]
|
||||
margin_right = 239.0
|
||||
margin_bottom = 70.0
|
||||
offset_right = 239.0
|
||||
offset_bottom = 70.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Open Shell (web)"
|
||||
|
||||
[node name="OpenShellFolder" type="Button" parent="HBoxContainer/Actions/GridContainer"]
|
||||
margin_left = 243.0
|
||||
margin_right = 482.0
|
||||
margin_bottom = 70.0
|
||||
offset_left = 243.0
|
||||
offset_right = 482.0
|
||||
offset_bottom = 70.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Open Shell (folder)"
|
||||
|
||||
[node name="ChangeWindowTitle" type="Button" parent="HBoxContainer/Actions/GridContainer"]
|
||||
margin_top = 74.0
|
||||
margin_right = 239.0
|
||||
margin_bottom = 144.0
|
||||
offset_top = 74.0
|
||||
offset_right = 239.0
|
||||
offset_bottom = 144.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Change Window Title"
|
||||
|
||||
[node name="ChangeWindowIcon" type="Button" parent="HBoxContainer/Actions/GridContainer"]
|
||||
margin_left = 243.0
|
||||
margin_top = 74.0
|
||||
margin_right = 482.0
|
||||
margin_bottom = 144.0
|
||||
offset_left = 243.0
|
||||
offset_top = 74.0
|
||||
offset_right = 482.0
|
||||
offset_bottom = 144.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Change Window Icon"
|
||||
|
||||
[node name="MoveWindowToForeground" type="Button" parent="HBoxContainer/Actions/GridContainer"]
|
||||
margin_top = 148.0
|
||||
margin_right = 239.0
|
||||
margin_bottom = 218.0
|
||||
offset_top = 148.0
|
||||
offset_right = 239.0
|
||||
offset_bottom = 218.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Move Window to Foreground"
|
||||
|
||||
[node name="RequestAttention" type="Button" parent="HBoxContainer/Actions/GridContainer"]
|
||||
margin_left = 243.0
|
||||
margin_top = 148.0
|
||||
margin_right = 482.0
|
||||
margin_bottom = 218.0
|
||||
offset_left = 243.0
|
||||
offset_top = 148.0
|
||||
offset_right = 482.0
|
||||
offset_bottom = 218.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Request Attention"
|
||||
|
||||
[node name="VibrateDeviceShort" type="Button" parent="HBoxContainer/Actions/GridContainer"]
|
||||
margin_top = 222.0
|
||||
margin_right = 239.0
|
||||
margin_bottom = 292.0
|
||||
offset_top = 222.0
|
||||
offset_right = 239.0
|
||||
offset_bottom = 292.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Vibrate Device (200 ms)"
|
||||
|
||||
[node name="VibrateDeviceLong" type="Button" parent="HBoxContainer/Actions/GridContainer"]
|
||||
margin_left = 243.0
|
||||
margin_top = 222.0
|
||||
margin_right = 482.0
|
||||
margin_bottom = 292.0
|
||||
offset_left = 243.0
|
||||
offset_top = 222.0
|
||||
offset_right = 482.0
|
||||
offset_bottom = 292.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Vibrate Device (1000 ms)"
|
||||
|
||||
[node name="AddGlobalMenuItems" type="Button" parent="HBoxContainer/Actions/GridContainer"]
|
||||
margin_top = 296.0
|
||||
margin_right = 239.0
|
||||
margin_bottom = 366.0
|
||||
offset_top = 296.0
|
||||
offset_right = 239.0
|
||||
offset_bottom = 366.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Add Global Menu Items"
|
||||
|
||||
[node name="RemoveGlobalMenuItem" type="Button" parent="HBoxContainer/Actions/GridContainer"]
|
||||
margin_left = 243.0
|
||||
margin_top = 296.0
|
||||
margin_right = 482.0
|
||||
margin_bottom = 366.0
|
||||
offset_left = 243.0
|
||||
offset_top = 296.0
|
||||
offset_right = 482.0
|
||||
offset_bottom = 366.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Remove Global Menu Item"
|
||||
|
||||
[node name="GetClipboard" type="Button" parent="HBoxContainer/Actions/GridContainer"]
|
||||
margin_top = 370.0
|
||||
margin_right = 239.0
|
||||
margin_bottom = 440.0
|
||||
offset_top = 370.0
|
||||
offset_right = 239.0
|
||||
offset_bottom = 440.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Get Clipboard Contents"
|
||||
|
||||
[node name="SetClipboard" type="Button" parent="HBoxContainer/Actions/GridContainer"]
|
||||
margin_left = 243.0
|
||||
margin_top = 370.0
|
||||
margin_right = 482.0
|
||||
margin_bottom = 440.0
|
||||
offset_left = 243.0
|
||||
offset_top = 370.0
|
||||
offset_right = 482.0
|
||||
offset_bottom = 440.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Set Clipboard Contents"
|
||||
|
||||
[node name="DisplayAlert" type="Button" parent="HBoxContainer/Actions/GridContainer"]
|
||||
margin_top = 444.0
|
||||
margin_right = 239.0
|
||||
margin_bottom = 514.0
|
||||
offset_top = 444.0
|
||||
offset_right = 239.0
|
||||
offset_bottom = 514.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Display Alert"
|
||||
|
||||
[node name="KillCurrentProcess" type="Button" parent="HBoxContainer/Actions/GridContainer"]
|
||||
margin_left = 243.0
|
||||
margin_top = 444.0
|
||||
margin_right = 482.0
|
||||
margin_bottom = 514.0
|
||||
offset_left = 243.0
|
||||
offset_top = 444.0
|
||||
offset_right = 482.0
|
||||
offset_bottom = 514.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Kill Current Process"
|
||||
|
||||
Reference in New Issue
Block a user