mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2025-12-31 09:49:06 +03:00
General proofreading (#1262)
* General proofreading for grammar and spelling * General formatting * Addition of appropriate literals where appropriate, i.e. `&"foo"` for `StringName` cases and `^"foo/bar"` for `NodePath` cases
This commit is contained in:
@@ -135,7 +135,7 @@ func _recursive_change_view_mode(current_node: Node) -> void:
|
||||
if not current_node:
|
||||
return
|
||||
|
||||
if current_node.has_method("set_view_mode"):
|
||||
if current_node.has_method(&"set_view_mode"):
|
||||
current_node.set_view_mode(view_mode_index)
|
||||
|
||||
for child in current_node.get_children():
|
||||
|
||||
@@ -9,7 +9,7 @@ var logger := CustomLogger.new()
|
||||
# called successfully otherwise.
|
||||
class CustomLogger extends Logger:
|
||||
func _log_message(message: String, _error: bool) -> void:
|
||||
CustomLoggerUI.get_node("Panel/RichTextLabel").call_deferred(&"append_text", message)
|
||||
CustomLoggerUI.get_node(^"Panel/RichTextLabel").call_deferred(&"append_text", message)
|
||||
|
||||
|
||||
func _log_error(
|
||||
@@ -46,16 +46,16 @@ class CustomLogger extends Logger:
|
||||
for backtrace in script_backtraces:
|
||||
script_backtraces_text += backtrace.format(trace_indent - 3) + "\n"
|
||||
|
||||
CustomLoggerUI.get_node("Panel/RichTextLabel").call_deferred(
|
||||
CustomLoggerUI.get_node(^"Panel/RichTextLabel").call_deferred(
|
||||
&"append_text",
|
||||
"%s %s %s[/color]\n[color=#999]%s[/color]\n[color=#999]%s[/color]" % [
|
||||
prefix,
|
||||
code,
|
||||
rationale,
|
||||
trace,
|
||||
script_backtraces_text,
|
||||
]
|
||||
)
|
||||
prefix,
|
||||
code,
|
||||
rationale,
|
||||
trace,
|
||||
script_backtraces_text,
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# Use `_init()` to register the logger as early as possible, which ensures that messages
|
||||
|
||||
@@ -19,7 +19,7 @@ func _ready() -> void:
|
||||
printraw("Normal message 1 (raw). ")
|
||||
printraw("Normal message 2 (raw).\n--------\n")
|
||||
|
||||
if bool(ProjectSettings.get_setting_with_override("application/run/flush_stdout_on_print")):
|
||||
if bool(ProjectSettings.get_setting_with_override(&"application/run/flush_stdout_on_print")):
|
||||
$FlushStdoutOnPrint.text = "Flush stdout on print: Yes (?)"
|
||||
else:
|
||||
$FlushStdoutOnPrint.text = "Flush stdout on print: No (?)"
|
||||
@@ -51,7 +51,7 @@ func _on_print_error_pressed() -> void:
|
||||
|
||||
|
||||
func _on_open_logs_folder_pressed() -> void:
|
||||
OS.shell_open(ProjectSettings.globalize_path(String(ProjectSettings.get_setting_with_override("debug/file_logging/log_path")).get_base_dir()))
|
||||
OS.shell_open(ProjectSettings.globalize_path(String(ProjectSettings.get_setting_with_override(&"debug/file_logging/log_path")).get_base_dir()))
|
||||
|
||||
|
||||
func _on_crash_engine_pressed() -> void:
|
||||
|
||||
@@ -8,7 +8,7 @@ may not support reporting tilt.
|
||||
Input accumulation and V-Sync are disabled by default in this demo to minimize
|
||||
input lag and get crisp lines (even at low FPS). This makes for the most
|
||||
responsive drawing experience possible. You can toggle them in the sidebar to
|
||||
see the difference it makes. Note that on Android, iOS and Web platforms, V-Sync
|
||||
see the difference it makes. Note that on Android, iOS, and Web platforms, V-Sync
|
||||
is forced at a system level and cannot be disabled.
|
||||
|
||||
Lines are drawn using the Line2D node. Every time you lift off the open and start a new
|
||||
|
||||
@@ -50,10 +50,10 @@ func _input(event: InputEvent) -> void:
|
||||
if event is InputEventMouseMotion:
|
||||
var event_mouse_motion := event as InputEventMouseMotion
|
||||
tablet_info.text = "Pressure: %.3f\nTilt: %.3v\nInverted pen: %s" % [
|
||||
event_mouse_motion.pressure,
|
||||
event_mouse_motion.tilt,
|
||||
"Yes" if event_mouse_motion.pen_inverted else "No",
|
||||
]
|
||||
event_mouse_motion.pressure,
|
||||
event_mouse_motion.tilt,
|
||||
"Yes" if event_mouse_motion.pen_inverted else "No",
|
||||
]
|
||||
|
||||
if event_mouse_motion.pressure <= 0 and stroke.points.size() > 1:
|
||||
# Initial part of a stroke; create a new line.
|
||||
@@ -61,6 +61,7 @@ func _input(event: InputEvent) -> void:
|
||||
# Enable the buttons if they were previously disabled.
|
||||
%ClearAllLines.disabled = false
|
||||
%UndoLastLine.disabled = false
|
||||
|
||||
if event_mouse_motion.pressure > 0:
|
||||
# Continue existing line.
|
||||
stroke.add_point(event_mouse_motion.position)
|
||||
@@ -73,7 +74,7 @@ func _input(event: InputEvent) -> void:
|
||||
width_curve.add_point(Vector2(
|
||||
float(pressure_idx) / pressures.size(),
|
||||
pressures[pressure_idx]
|
||||
))
|
||||
))
|
||||
|
||||
# Split into a new line if it gets too long to avoid performance issues.
|
||||
# This is mostly reached when input accumulation is disabled, as enabling
|
||||
@@ -175,7 +176,7 @@ func _on_msaa_item_selected(index: int) -> void:
|
||||
|
||||
func _on_max_fps_value_changed(value: float) -> void:
|
||||
# Since the project has low-processor usage mode enabled, we change its sleep interval instead.
|
||||
# Since this is a value in microseconds between frames, we have to convert it from a FPS value.
|
||||
# Since this is a value in microseconds between frames, we have to convert it from an FPS value.
|
||||
@warning_ignore("narrowing_conversion")
|
||||
OS.low_processor_usage_mode_sleep_usec = 1_000_000.0 / value
|
||||
$CanvasLayer/PanelContainer/Options/MaxFPS/Value.text = str(roundi(value))
|
||||
|
||||
@@ -186,14 +186,14 @@ horizontal_alignment = 1
|
||||
layout_mode = 2
|
||||
tooltip_text = "Disable V-Sync to achieve lower input latency.
|
||||
|
||||
Note that Android, iOS and Web platforms enforce
|
||||
Note that Android, iOS, and Web platforms enforce
|
||||
V-Sync at a system level with no reliable way to disable it."
|
||||
text = "V-Sync"
|
||||
|
||||
[node name="InputAccumulation" type="CheckButton" parent="CanvasLayer/PanelContainer/Options"]
|
||||
layout_mode = 2
|
||||
tooltip_text = "If enabled, inputs are collected and merged into a single input event on every rendered frame.
|
||||
By default, this is enabled in Godot, but this project disables it by default.
|
||||
Usually this is enabled in Godot, but this project disables it by default.
|
||||
|
||||
This should be left disabled for drawing apps that expect precise input,
|
||||
as lines can become visibly jagged otherwise."
|
||||
|
||||
@@ -72,18 +72,18 @@ func _process(_delta: float) -> void:
|
||||
joypad_axes.get_node(str(axis)).self_modulate.a = scaled_alpha_value
|
||||
|
||||
# Highlight axis labels that are within the "active" value range. Similar to the button highlighting for loop below.
|
||||
axes.get_node("Axis" + str(axis) + "/Label").add_theme_color_override("font_color", FONT_COLOR_DEFAULT)
|
||||
axes.get_node("Axis" + str(axis) + "/Label").add_theme_color_override(&"font_color", FONT_COLOR_DEFAULT)
|
||||
if abs(axis_value) >= DEADZONE:
|
||||
axes.get_node("Axis" + str(axis) + "/Label").add_theme_color_override("font_color", FONT_COLOR_ACTIVE)
|
||||
axes.get_node("Axis" + str(axis) + "/Label").add_theme_color_override(&"font_color", FONT_COLOR_ACTIVE)
|
||||
|
||||
# Loop through the buttons and highlight the ones that are pressed.
|
||||
for button in range(int(min(JOY_BUTTON_SDL_MAX, 21))):
|
||||
if Input.is_joy_button_pressed(joy_num, button):
|
||||
button_grid.get_child(button).add_theme_color_override("font_color", FONT_COLOR_ACTIVE)
|
||||
button_grid.get_child(button).add_theme_color_override(&"font_color", FONT_COLOR_ACTIVE)
|
||||
if button <= JOY_BUTTON_MISC1:
|
||||
joypad_buttons.get_child(button).show()
|
||||
else:
|
||||
button_grid.get_child(button).add_theme_color_override("font_color", FONT_COLOR_DEFAULT)
|
||||
button_grid.get_child(button).add_theme_color_override(&"font_color", FONT_COLOR_DEFAULT)
|
||||
if button <= JOY_BUTTON_MISC1:
|
||||
joypad_buttons.get_child(button).hide()
|
||||
|
||||
@@ -143,6 +143,7 @@ func set_joypad_name(joy_name: String, joy_guid: String) -> void:
|
||||
for node: CanvasItem in [$JoypadDiagram, $Axes, $Buttons, $Vibration, $VBoxContainer]:
|
||||
node.modulate.a = 1.0
|
||||
|
||||
|
||||
func clear_joypad_name() -> void:
|
||||
joypad_name.set_text("[i]No controller detected at ID %d.[/i]" % joypad_number.value)
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ const MAIN_BUTTONS = MOUSE_BUTTON_MASK_LEFT | MOUSE_BUTTON_MASK_MIDDLE | MOUSE_B
|
||||
func _ready() -> void:
|
||||
if OS.has_feature("double"):
|
||||
%HelpLabel.text = "Double precision is enabled in this engine build.\nNo shaking should occur at high coordinate levels\n(±65,536 or more on any axis)."
|
||||
%HelpLabel.add_theme_color_override("font_color", Color(0.667, 1, 0.667))
|
||||
%HelpLabel.add_theme_color_override(&"font_color", Color(0.667, 1, 0.667))
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
|
||||
@@ -14,7 +14,7 @@ Check out this demo on the asset library: https://godotengine.org/asset-library/
|
||||
|
||||
## How does it work?
|
||||
|
||||
In both 2D and 3D, colored lines are drawn indicating the basis vectors as well as the origin vector. For 3D, this means cuboids. If you translate, rotate, scale, or shear the AxisMarker objects, you will be able to see how it affects the transform's component vectors, and all children objects are also appropriately transformed.
|
||||
In both 2D and 3D, colored lines are drawn indicating the basis vectors as well as the origin vector. For 3D, this means cuboids. If you translate, rotate, scale, or shear the AxisMarker objects, you will be able to see how it affects the transform's component vectors, and all child objects are also appropriately transformed.
|
||||
|
||||
You are encouraged to manipulate the AxisMarker objects both in the main viewport and in the inspector. You are encouraged to duplicate them in the hierarchy and parent them any way you wish.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ It includes:
|
||||
- Adding physical objects to new windows.
|
||||
- Showcase of all Dialog Windows.
|
||||
- Showcase of all Popup Windows.
|
||||
- Adding elements to a Popup Menu.
|
||||
- Adding elements to a PopupMenu.
|
||||
- Adding an icon to the system tray.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
extends Node
|
||||
|
||||
|
||||
@export var sprite: Sprite2D
|
||||
|
||||
|
||||
func generate_polygon():
|
||||
# Make a bitmap out of a sprite.
|
||||
var bitmap := BitMap.new()
|
||||
|
||||
@@ -75,7 +75,7 @@ func _on_draggable_window_close_pressed() -> void:
|
||||
|
||||
|
||||
func _on_bg_draggable_window_toggled(toggled_on: bool) -> void:
|
||||
draggable_window.get_node("BG").visible = toggled_on
|
||||
draggable_window.get_node(^"BG").visible = toggled_on
|
||||
|
||||
|
||||
func _on_passthrough_polygon_item_selected(index: int) -> void:
|
||||
@@ -83,7 +83,7 @@ func _on_passthrough_polygon_item_selected(index: int) -> void:
|
||||
0:
|
||||
draggable_window.mouse_passthrough_polygon = []
|
||||
1:
|
||||
draggable_window.get_node("PassthroughGenerator").generate_polygon()
|
||||
draggable_window.get_node(^"PassthroughGenerator").generate_polygon()
|
||||
2:
|
||||
draggable_window.mouse_passthrough_polygon = [
|
||||
Vector2(16, 0), Vector2(16, 128),
|
||||
@@ -119,6 +119,7 @@ func _on_file_dialog_options_item_selected(index: int) -> void:
|
||||
4:
|
||||
file_dialog.file_mode = FileDialog.FILE_MODE_SAVE_FILE
|
||||
|
||||
|
||||
func _on_native_dialog_toggled(toggled_on: bool) -> void:
|
||||
file_dialog.use_native_dialog = toggled_on
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
[ext_resource type="Script" uid="uid://b4ngyw7e2c75u" path="res://scenes/disable_other.gd" id="2_psh0l"]
|
||||
[ext_resource type="Script" uid="uid://evvrji8vwf5l" path="res://scenes/text_field.gd" id="3_bgndp"]
|
||||
[ext_resource type="PackedScene" uid="uid://ek1fmwy87san" path="res://scenes/draggable_window/draggable_window.tscn" id="4_diw6b"]
|
||||
[ext_resource type="PackedScene" uid="uid://dx84v67isxyjv" path="res://scenes/file_dialogue/file_dialog.tscn" id="5_f4o8g"]
|
||||
[ext_resource type="PackedScene" uid="uid://cudrukovmha7p" path="res://scenes/accept_dialogue/accept_dialog.tscn" id="6_st8be"]
|
||||
[ext_resource type="PackedScene" uid="uid://1nswovajdv3n" path="res://scenes/confimation_dialogue/confirmation_dialog.tscn" id="7_wii4q"]
|
||||
[ext_resource type="PackedScene" uid="uid://dx84v67isxyjv" path="res://scenes/file_dialog/file_dialog.tscn" id="5_f4o8g"]
|
||||
[ext_resource type="PackedScene" uid="uid://cudrukovmha7p" path="res://scenes/accept_dialog/accept_dialog.tscn" id="6_st8be"]
|
||||
[ext_resource type="PackedScene" uid="uid://1nswovajdv3n" path="res://scenes/confirmation_dialog/confirmation_dialog.tscn" id="7_wii4q"]
|
||||
[ext_resource type="PackedScene" uid="uid://p7lgllpnc8h8" path="res://scenes/popup/popup.tscn" id="8_vohc5"]
|
||||
[ext_resource type="PackedScene" uid="uid://j7j6fe7plvmt" path="res://scenes/popup_menu/popup_menu.tscn" id="9_b1y32"]
|
||||
[ext_resource type="PackedScene" uid="uid://dj15to28g17lb" path="res://scenes/popup_panel/popup_panel.tscn" id="10_rn47v"]
|
||||
@@ -57,7 +57,7 @@ text = "Show window"
|
||||
|
||||
[node name="WindowTitleEdit" type="LineEdit" parent="HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
placeholder_text = "Window's Title"
|
||||
placeholder_text = "Window Title"
|
||||
|
||||
[node name="TransientWindow" type="CheckButton" parent="HBoxContainer/VBoxContainer" node_paths=PackedStringArray("others")]
|
||||
layout_mode = 2
|
||||
@@ -69,13 +69,11 @@ others = [NodePath("../ExclusiveWindow")]
|
||||
layout_mode = 2
|
||||
tooltip_text = "Needs transient enabled to work."
|
||||
disabled = true
|
||||
text = "Exclusive
|
||||
"
|
||||
text = "Exclusive"
|
||||
|
||||
[node name="UnresizableWindow" type="CheckButton" parent="HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Unresizable
|
||||
"
|
||||
text = "Unresizable"
|
||||
|
||||
[node name="BorderlessWindow" type="CheckButton" parent="HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
@@ -88,8 +86,7 @@ text = "Always on Top"
|
||||
[node name="TransparentWindow" type="CheckButton" parent="HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
tooltip_text = "Needs embed_subwindows disabled to work."
|
||||
text = "Transparent
|
||||
"
|
||||
text = "Transparent"
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
@@ -105,7 +102,7 @@ layout_mode = 2
|
||||
[node name="DraggableWindowButton" type="Button" parent="HBoxContainer/VBoxContainer/HBoxContainerDW"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Draggable window"
|
||||
text = "Draggable Window"
|
||||
|
||||
[node name="Close" type="Button" parent="HBoxContainer/VBoxContainer/HBoxContainerDW"]
|
||||
layout_mode = 2
|
||||
@@ -114,10 +111,9 @@ text = "X"
|
||||
[node name="DraggableWindowExplanation" type="RichTextLabel" parent="HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/normal_font_size = 12
|
||||
text = "This window uses Area2D to detect if user clicked inside of it.
|
||||
Since it's Area2D, you can change it's CollisionShape2D.
|
||||
But since Area2D is a Physics Object, \"Physics Object Picking\" inside of Window's properties hard to be enabled.
|
||||
"
|
||||
text = "This window uses an Area2D to detect if the user clicked inside of it.
|
||||
Since it's an Area2D, you can change its CollisionShape2D.
|
||||
But since Area2D is a Physics Object, the \"Physics Object Picking\" property has to be enabled in Window."
|
||||
fit_content = true
|
||||
|
||||
[node name="BGDraggableWindow" type="CheckButton" parent="HBoxContainer/VBoxContainer"]
|
||||
@@ -170,8 +166,7 @@ popup/item_4/id = 4
|
||||
|
||||
[node name="NativeDialog" type="CheckButton" parent="HBoxContainer/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
text = "Use Native
|
||||
Dialog"
|
||||
text = "Use Native Dialog"
|
||||
|
||||
[node name="FileDialogOutput" type="TextEdit" parent="HBoxContainer/VBoxContainer2"]
|
||||
custom_minimum_size = Vector2(200, 150)
|
||||
@@ -209,7 +204,7 @@ text = "Enter"
|
||||
[node name="AcceptOutput" type="TextEdit" parent="HBoxContainer/VBoxContainer2"]
|
||||
custom_minimum_size = Vector2(200, 70)
|
||||
layout_mode = 2
|
||||
placeholder_text = "Dialogue result will show up here."
|
||||
placeholder_text = "Dialog result will show up here."
|
||||
editable = false
|
||||
wrap_mode = 1
|
||||
|
||||
@@ -223,7 +218,7 @@ horizontal_alignment = 1
|
||||
|
||||
[node name="ConfirmationButton" type="Button" parent="HBoxContainer/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
text = "Show Dialogue"
|
||||
text = "Show Dialog"
|
||||
|
||||
[node name="ConfirmationOutput" type="TextEdit" parent="HBoxContainer/VBoxContainer2"]
|
||||
custom_minimum_size = Vector2(200, 35)
|
||||
@@ -250,7 +245,7 @@ layout_mode = 2
|
||||
theme_override_font_sizes/normal_font_size = 12
|
||||
theme_override_font_sizes/mono_font_size = 12
|
||||
bbcode_enabled = true
|
||||
text = "Popup hiding on mouse exit is handled by via [code]mouse_exited[/code] signal"
|
||||
text = "Popup hiding on mouse exit is handled by via the [code]mouse_exited[/code] signal."
|
||||
fit_content = true
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="HBoxContainer/VBoxContainer3"]
|
||||
|
||||
@@ -7,5 +7,5 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _on_close_requested() -> void:
|
||||
print("%s %s was hidden." % [str(self.get_class()), name])
|
||||
print("%s %s was hidden." % [str(get_class()), name])
|
||||
hide()
|
||||
|
||||
@@ -26,8 +26,8 @@ func _refresh_shader_params() -> void:
|
||||
@warning_ignore("integer_division")
|
||||
var _max := (max_noise + 1) / 2
|
||||
var _material: ShaderMaterial = $SeamlessNoiseTexture.material
|
||||
_material.set_shader_parameter("min_value", _min)
|
||||
_material.set_shader_parameter("max_value", _max)
|
||||
_material.set_shader_parameter(&"min_value", _min)
|
||||
_material.set_shader_parameter(&"max_value", _max)
|
||||
|
||||
|
||||
func _on_documentation_button_pressed() -> void:
|
||||
|
||||
@@ -85,7 +85,7 @@ func _on_add_global_menu_items_pressed() -> void:
|
||||
func(tag: String) -> void: print("Key main 1 " + str(tag)),
|
||||
null,
|
||||
(KEY_MASK_META | KEY_1) as Key
|
||||
)
|
||||
)
|
||||
DisplayServer.global_menu_add_separator("_main/Hello")
|
||||
DisplayServer.global_menu_add_item("_main/Hello", "World2", func(tag: String) -> void: print("Clicked main 2 " + str(tag)))
|
||||
|
||||
|
||||
@@ -19,27 +19,27 @@ func datetime_to_string(date: Dictionary) -> void:
|
||||
):
|
||||
# Date and time.
|
||||
return "{year}-{month}-{day} {hour}:{minute}:{second}".format({
|
||||
year = str(date.year).pad_zeros(2),
|
||||
month = str(date.month).pad_zeros(2),
|
||||
day = str(date.day).pad_zeros(2),
|
||||
hour = str(date.hour).pad_zeros(2),
|
||||
minute = str(date.minute).pad_zeros(2),
|
||||
second = str(date.second).pad_zeros(2),
|
||||
})
|
||||
year = str(date.year).pad_zeros(2),
|
||||
month = str(date.month).pad_zeros(2),
|
||||
day = str(date.day).pad_zeros(2),
|
||||
hour = str(date.hour).pad_zeros(2),
|
||||
minute = str(date.minute).pad_zeros(2),
|
||||
second = str(date.second).pad_zeros(2),
|
||||
})
|
||||
elif date.has("year") and date.has("month") and date.has("day"):
|
||||
# Date only.
|
||||
return "{year}-{month}-{day}".format({
|
||||
year = str(date.year).pad_zeros(2),
|
||||
month = str(date.month).pad_zeros(2),
|
||||
day = str(date.day).pad_zeros(2),
|
||||
})
|
||||
year = str(date.year).pad_zeros(2),
|
||||
month = str(date.month).pad_zeros(2),
|
||||
day = str(date.day).pad_zeros(2),
|
||||
})
|
||||
else:
|
||||
# Time only.
|
||||
return "{hour}:{minute}:{second}".format({
|
||||
hour = str(date.hour).pad_zeros(2),
|
||||
minute = str(date.minute).pad_zeros(2),
|
||||
second = str(date.second).pad_zeros(2),
|
||||
})
|
||||
hour = str(date.hour).pad_zeros(2),
|
||||
minute = str(date.minute).pad_zeros(2),
|
||||
second = str(date.second).pad_zeros(2),
|
||||
})
|
||||
|
||||
|
||||
func scan_midi_inputs() -> String:
|
||||
@@ -55,13 +55,14 @@ func scan_midi_inputs() -> String:
|
||||
|
||||
func add_header(header: String) -> void:
|
||||
rtl.append_text("\n[font_size=24][color=#5cf]{header}[/color][/font_size]\n[font_size=1]\n[/font_size]".format({
|
||||
header = header,
|
||||
}))
|
||||
header = header,
|
||||
}))
|
||||
|
||||
# Also print to the terminal for easy copy-pasting and headless usage.
|
||||
print_rich("\n[b][u][color=blue]{header}[/color][/u][/b]\n".format({
|
||||
header = header,
|
||||
}))
|
||||
header = header,
|
||||
}))
|
||||
|
||||
|
||||
func add_line(key: String, value: Variant) -> void:
|
||||
line_count += 1
|
||||
@@ -71,20 +72,20 @@ func add_line(key: String, value: Variant) -> void:
|
||||
value = "[color=6f7]true[/color]" if original_value else "[color=#f76]false[/color]"
|
||||
|
||||
rtl.append_text("{bgcolor}[color=#9df]{key}:[/color] {value}{bgcolor_end}\n".format({
|
||||
key = key,
|
||||
value = value if str(value) != "" else "[color=#fff8](empty)[/color]",
|
||||
bgcolor = "[bgcolor=#8883]" if line_count % 2 == 0 else "",
|
||||
bgcolor_end = "[/bgcolor]" if line_count % 2 == 0 else "",
|
||||
}))
|
||||
key = key,
|
||||
value = value if str(value) != "" else "[color=#fff8](empty)[/color]",
|
||||
bgcolor = "[bgcolor=#8883]" if line_count % 2 == 0 else "",
|
||||
bgcolor_end = "[/bgcolor]" if line_count % 2 == 0 else "",
|
||||
}))
|
||||
if typeof(original_value) == TYPE_BOOL:
|
||||
# Colorize boolean values (`print_rich()`-friendly version, using basic colors only).
|
||||
value = "[color=green]true[/color]" if original_value else "[color=red]false[/color]"
|
||||
|
||||
# Also print to the terminal for easy copy-pasting and headless usage.
|
||||
print_rich("[b][color=cyan]{key}:[/color][/b] {value}".format({
|
||||
key = key,
|
||||
value = value if str(value) != "" else "[code](empty)[/code]",
|
||||
}))
|
||||
key = key,
|
||||
value = value if str(value) != "" else "[code](empty)[/code]",
|
||||
}))
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -118,14 +119,14 @@ func _ready() -> void:
|
||||
add_line("Startup screen refresh rate", ("%f Hz" % DisplayServer.screen_get_refresh_rate()) if DisplayServer.screen_get_refresh_rate() > 0.0 else "")
|
||||
add_line("Usable (safe) area rectangle", DisplayServer.get_display_safe_area())
|
||||
add_line("Screen orientation", [
|
||||
"Landscape",
|
||||
"Portrait",
|
||||
"Landscape (reverse)",
|
||||
"Portrait (reverse)",
|
||||
"Landscape (defined by sensor)",
|
||||
"Portrait (defined by sensor)",
|
||||
"Defined by sensor",
|
||||
][DisplayServer.screen_get_orientation()])
|
||||
"Landscape",
|
||||
"Portrait",
|
||||
"Landscape (reverse)",
|
||||
"Portrait (reverse)",
|
||||
"Landscape (defined by sensor)",
|
||||
"Portrait (defined by sensor)",
|
||||
"Defined by sensor",
|
||||
][DisplayServer.screen_get_orientation()])
|
||||
|
||||
add_header("Engine")
|
||||
add_line("Version", Engine.get_version_info()["string"])
|
||||
@@ -214,16 +215,17 @@ func _ready() -> void:
|
||||
if RenderingServer.get_current_rendering_method() != "gl_compatibility":
|
||||
# Querying the adapter type isn't supported in Compatibility.
|
||||
add_line("Adapter type", [
|
||||
"Other (Unknown)",
|
||||
"Integrated",
|
||||
"Discrete",
|
||||
"Virtual",
|
||||
"CPU",
|
||||
][RenderingServer.get_video_adapter_type()])
|
||||
"Other (Unknown)",
|
||||
"Integrated",
|
||||
"Discrete",
|
||||
"Virtual",
|
||||
"CPU",
|
||||
][RenderingServer.get_video_adapter_type()])
|
||||
add_line("Adapter graphics API version", RenderingServer.get_video_adapter_api_version())
|
||||
|
||||
var video_adapter_driver_info := OS.get_video_adapter_driver_info()
|
||||
if video_adapter_driver_info.size() > 0:
|
||||
add_line("Adapter driver name", video_adapter_driver_info[0])
|
||||
|
||||
if video_adapter_driver_info.size() > 1:
|
||||
add_line("Adapter driver version", video_adapter_driver_info[1])
|
||||
|
||||
@@ -8,7 +8,7 @@ A demo showing the various window management features available through
|
||||
- Minimizing and maximizing.
|
||||
- Moving the window around.
|
||||
- Making the window transparent.
|
||||
- Capturing, hiding or confining the mouse.
|
||||
- Capturing, hiding, or confining the mouse.
|
||||
- Getting various information about the screens, including DPI and refresh rate.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
@@ -29,6 +29,7 @@ func _ready() -> void:
|
||||
if DisplayServer.get_screen_count() > 1:
|
||||
$Labels/Label_Screen1_RefreshRate.text = "Screen1 Refresh Rate: %.2f Hz" % DisplayServer.screen_get_refresh_rate(1)
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
var modetext := "Mode: "
|
||||
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
|
||||
@@ -111,40 +112,40 @@ func _input(event: InputEvent) -> void:
|
||||
|
||||
func check_wm_api() -> bool:
|
||||
var s := ""
|
||||
if not DisplayServer.has_method("get_screen_count"):
|
||||
if not DisplayServer.has_method(&"get_screen_count"):
|
||||
s += " - get_screen_count()\n"
|
||||
if not DisplayServer.has_method("window_get_current_screen"):
|
||||
if not DisplayServer.has_method(&"window_get_current_screen"):
|
||||
s += " - window_get_current_screen()\n"
|
||||
if not DisplayServer.has_method("window_set_current_screen"):
|
||||
if not DisplayServer.has_method(&"window_set_current_screen"):
|
||||
s += " - window_set_current_screen()\n"
|
||||
if not DisplayServer.has_method("screen_get_position"):
|
||||
if not DisplayServer.has_method(&"screen_get_position"):
|
||||
s += " - screen_get_position()\n"
|
||||
if not DisplayServer.has_method("window_get_size"):
|
||||
if not DisplayServer.has_method(&"window_get_size"):
|
||||
s += " - window_get_size()\n"
|
||||
if not DisplayServer.has_method("window_get_position"):
|
||||
if not DisplayServer.has_method(&"window_get_position"):
|
||||
s += " - window_get_position()\n"
|
||||
if not DisplayServer.has_method("window_set_position"):
|
||||
if not DisplayServer.has_method(&"window_set_position"):
|
||||
s += " - window_set_position()\n"
|
||||
if not DisplayServer.has_method("window_get_size"):
|
||||
if not DisplayServer.has_method(&"window_get_size"):
|
||||
s += " - get_window_size()\n"
|
||||
if not DisplayServer.has_method("window_set_size"):
|
||||
if not DisplayServer.has_method(&"window_set_size"):
|
||||
s += " - window_set_size()\n"
|
||||
# These function are no longer and this is set through flags!
|
||||
# if not DisplayServer.has_method("set_window_fullscreen"):
|
||||
# if not DisplayServer.has_method(&"set_window_fullscreen"):
|
||||
# s += " - set_window_fullscreen()\n"
|
||||
# if not DisplayServer.window_get_flag() OS.has_method("is_window_fullscreen"):
|
||||
# if not DisplayServer.window_get_flag() OS.has_method(&"is_window_fullscreen"):
|
||||
# s += " - is_window_fullscreen()\n"
|
||||
# if not OS.has_method("set_window_resizable"):
|
||||
# if not OS.has_method(&"set_window_resizable"):
|
||||
# s += " - set_window_resizable()\n"
|
||||
# if not OS.has_method("is_window_resizable"):
|
||||
# if not OS.has_method(&"is_window_resizable"):
|
||||
# s += " - is_window_resizable()\n"
|
||||
# if not OS.has_method("set_window_minimized"):
|
||||
# if not OS.has_method(&"set_window_minimized"):
|
||||
# s += " - set_window_minimized()\n"
|
||||
# if not OS.has_method("is_window_minimized"):
|
||||
# if not OS.has_method(&"is_window_minimized"):
|
||||
# s += " - is_window_minimized()\n"
|
||||
# if not OS.has_method("set_window_maximized"):
|
||||
# if not OS.has_method(&"set_window_maximized"):
|
||||
# s += " - set_window_maximized()\n"
|
||||
# if not OS.has_method("is_window_maximized"):
|
||||
# if not OS.has_method(&"is_window_maximized"):
|
||||
# s += " - is_window_maximized()\n"
|
||||
|
||||
if s.length() == 0:
|
||||
@@ -211,6 +212,7 @@ func _on_button_mouse_mode_captured_pressed() -> void:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
observer.state = observer.State.GRAB
|
||||
|
||||
|
||||
func _on_button_mouse_mode_confined_pressed() -> void:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CONFINED
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ func _input(event: InputEvent) -> void:
|
||||
# Use `screen_relative` to make sensitivity independent of the viewport resolution.
|
||||
r_pos = -event.screen_relative * MOUSE_SENSITIVITY
|
||||
|
||||
if event.is_action("ui_cancel") and event.is_pressed() and not event.is_echo():
|
||||
if event.is_action(&"ui_cancel") and event.is_pressed() and not event.is_echo():
|
||||
if state == State.GRAB:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
state = State.MENU
|
||||
|
||||
@@ -337,7 +337,7 @@ text = "This is an Implementation-Test-Demo
|
||||
It is used to help implementing a new window handling api
|
||||
across platforms.
|
||||
|
||||
Your platform lacks at the moment the following methods:
|
||||
Your platform lacks the following methods at the moment:
|
||||
"
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="Control"]
|
||||
|
||||
Reference in New Issue
Block a user