mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 15:00:09 +01:00
Improve style in many demos (#1263)
This commit is contained in:
@@ -31,7 +31,7 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
var modetext := "Mode: "
|
||||
var modetext: String = "Mode: "
|
||||
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
|
||||
modetext += "Fullscreen\n"
|
||||
else:
|
||||
@@ -85,11 +85,11 @@ func _physics_process(_delta: float) -> void:
|
||||
$Buttons/Button_MouseModeCaptured.set_pressed(Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED)
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event is InputEventMouseMotion:
|
||||
mouse_position = event.position
|
||||
func _input(input_event: InputEvent) -> void:
|
||||
if input_event is InputEventMouseMotion:
|
||||
mouse_position = input_event.position
|
||||
|
||||
if event is InputEventKey:
|
||||
if input_event is InputEventKey:
|
||||
if Input.is_action_pressed(&"mouse_mode_visible"):
|
||||
observer.state = observer.State.MENU
|
||||
_on_button_mouse_mode_visible_pressed()
|
||||
@@ -111,7 +111,7 @@ func _input(event: InputEvent) -> void:
|
||||
|
||||
|
||||
func check_wm_api() -> bool:
|
||||
var s := ""
|
||||
var s: String = ""
|
||||
if not DisplayServer.has_method(&"get_screen_count"):
|
||||
s += " - get_screen_count()\n"
|
||||
if not DisplayServer.has_method(&"window_get_current_screen"):
|
||||
|
||||
@@ -31,12 +31,12 @@ func _process(delta: float) -> void:
|
||||
r_pos = Vector2.ZERO
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event is InputEventMouseMotion:
|
||||
func _input(input_event: InputEvent) -> void:
|
||||
if input_event is InputEventMouseMotion:
|
||||
# Use `screen_relative` to make sensitivity independent of the viewport resolution.
|
||||
r_pos = -event.screen_relative * MOUSE_SENSITIVITY
|
||||
r_pos = -input_event.screen_relative * MOUSE_SENSITIVITY
|
||||
|
||||
if event.is_action(&"ui_cancel") and event.is_pressed() and not event.is_echo():
|
||||
if input_event.is_action(&"ui_cancel") and input_event.is_pressed() and not input_event.is_echo():
|
||||
if state == State.GRAB:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
state = State.MENU
|
||||
|
||||
@@ -200,7 +200,7 @@ anchors_preset = 11
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -241.0
|
||||
offset_left = -310.0
|
||||
offset_top = 10.0
|
||||
offset_right = -10.0
|
||||
offset_bottom = -10.0
|
||||
|
||||
Reference in New Issue
Block a user