From 61b630c6c09a21cbf940c4995f2e7520fc5bd192 Mon Sep 17 00:00:00 2001 From: Just Dzhi Date: Sat, 30 Sep 2023 20:58:05 +0400 Subject: [PATCH] fullscreen mode in window.gd --- project.godot | 16 +++++----------- src/window.gd | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/project.godot b/project.godot index f8a7d71..306ed25 100644 --- a/project.godot +++ b/project.godot @@ -8,16 +8,6 @@ config_version=4 -_global_script_classes=[ { -"base": "EditorVCSInterface", -"class": "GitAPI", -"language": "NativeScript", -"path": "res://addons/godot-git-plugin/git_api.gdns" -} ] -_global_script_class_icons={ -"GitAPI": "" -} - [application] config/name="LD54" @@ -29,11 +19,15 @@ config/icon="res://icon.png" [autoload] Global="*res://src/global.gd" +Window="*res://src/window.gd" [display] window/size/width=320 window/size/height=180 +window/size/test_width=1280 +window/size/test_height=720 +window/handheld/orientation="sensor_landscape" window/stretch/mode="viewport" window/stretch/aspect="keep" @@ -44,7 +38,7 @@ version_control_plugin_name="GitAPI" [gdnative] -singletons=[ "res://addons/godot-git-plugin/git_api.gdnlib" ] +singletons=[ ] [global] diff --git a/src/window.gd b/src/window.gd index 2f5768c..70b95f7 100644 --- a/src/window.gd +++ b/src/window.gd @@ -1,8 +1,22 @@ extends Node func _ready(): + set_process_input(true) _change_window_title("Hello World!") OS.min_window_size = Vector2(320, 180) func _change_window_title(_title): OS.set_window_title(ProjectSettings.get_setting("application/config/name") + " - " + _title) + +func _input(event): + if event is InputEventKey and event.scancode == 16777254 and event.pressed: #scancode 16777254 == KEY_F11 + if OS.window_fullscreen == true: + OS.window_fullscreen = false + else: + OS.window_fullscreen = true + + #if event is InputEventMouseButton and event.button_index == 1: + # Input.mouse_mode = Input.MOUSE_MODE_CAPTURED + #if event is InputEventKey and event.scancode == 16777240 and event.pressed: #scancode 16777240 == KEY_ALT + # Input.mouse_mode = Input.MOUSE_MODE_VISIBLE +