From d05ee9775b19172d75e13d212f65314cad0a1063 Mon Sep 17 00:00:00 2001 From: Nathan Lovato Date: Thu, 5 Mar 2020 12:15:52 -0600 Subject: [PATCH] Add support for toggling full-screen with F11 --- project/project.godot | 5 +++++ project/src/World/GameInitializer.gd | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/project/project.godot b/project/project.godot index 70b6f49..9b972ed 100644 --- a/project/project.godot +++ b/project/project.godot @@ -449,6 +449,11 @@ face_down={ "events": [ Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":3,"axis_value":1.0,"script":null) ] } +toggle_fullscreen={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777254,"unicode":0,"echo":false,"script":null) + ] +} [layer_names] diff --git a/project/src/World/GameInitializer.gd b/project/src/World/GameInitializer.gd index 97a1840..0c015af 100644 --- a/project/src/World/GameInitializer.gd +++ b/project/src/World/GameInitializer.gd @@ -32,6 +32,12 @@ func _ready() -> void: camera.setup_distortion_camera() +func _input(event: InputEvent) -> void: + if event.is_action_pressed("toggle_fullscreen"): + OS.window_fullscreen = not OS.window_fullscreen + get_tree().set_input_as_handled() + + func _on_Spawner_pirate_spawned(pirate: Node) -> void: pirate.register_on_map(map) pirate.setup_world_objects(_world_objects)