first commit
This commit is contained in:
27
scripts/autoloads/windowman.gd
Normal file
27
scripts/autoloads/windowman.gd
Normal file
@@ -0,0 +1,27 @@
|
||||
extends Node
|
||||
|
||||
@onready var fullscreen: bool = ProjectSettings.get_setting("display/window/size/mode") == Window.MODE_EXCLUSIVE_FULLSCREEN | Window.MODE_FULLSCREEN
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Input.is_action_just_pressed("fullscreen"):
|
||||
fullscreen = !fullscreen
|
||||
toggle_fullscreen()
|
||||
|
||||
func _notification(what: int) -> void:
|
||||
if what == Window.NOTIFICATION_APPLICATION_FOCUS_OUT:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event is InputEventMouse:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
elif !event.is_action("escape"):
|
||||
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
|
||||
|
||||
func toggle_fullscreen() -> void:
|
||||
if fullscreen:
|
||||
if OS.get_name() == "Windows":
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN)
|
||||
else:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
|
||||
else:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
||||
1
scripts/autoloads/windowman.gd.uid
Normal file
1
scripts/autoloads/windowman.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ce5vnfu1ucdic
|
||||
7
scripts/player.gd
Normal file
7
scripts/player.gd
Normal file
@@ -0,0 +1,7 @@
|
||||
extends CharacterBody2D
|
||||
|
||||
const SPEED: int = 500
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
velocity = Input.get_vector("move_left","move_right","move_up","move_down") * delta * SPEED * 3
|
||||
move_and_slide()
|
||||
1
scripts/player.gd.uid
Normal file
1
scripts/player.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dxvslwwnnlosy
|
||||
Reference in New Issue
Block a user