Доработка. Горячие клавиши во всех режимах

This commit is contained in:
sasha80
2023-09-29 08:43:34 +03:00
parent ecb27f178d
commit ab48db0a22
4 changed files with 26 additions and 1 deletions

20
scripts/hotkeys.gd Normal file
View File

@@ -0,0 +1,20 @@
extends Node
func _ready() -> void:
signaller.connect('full_screen', Callable(self, 'toggle_full_screen').bind(0))
func _input(event: InputEvent) -> void:
if event is InputEventKey:
if event.pressed and event.physical_keycode == KEY_F11:
signaller.emit_signal('full_screen')
## Переключает режим окна программы полный - обычный экран
func toggle_full_screen(id: int) -> void:
var mode = DisplayServer.window_get_mode(id)
mode = DisplayServer.WINDOW_MODE_WINDOWED \
if mode == DisplayServer.WINDOW_MODE_FULLSCREEN \
else DisplayServer.WINDOW_MODE_FULLSCREEN
DisplayServer.window_set_mode(mode, id)