Skip to content

Commit d05ee97

Browse files
committed
Add support for toggling full-screen with F11
1 parent ff0a553 commit d05ee97

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

project/project.godot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,11 @@ face_down={
449449
"events": [ Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":3,"axis_value":1.0,"script":null)
450450
]
451451
}
452+
toggle_fullscreen={
453+
"deadzone": 0.5,
454+
"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)
455+
]
456+
}
452457

453458
[layer_names]
454459

project/src/World/GameInitializer.gd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ func _ready() -> void:
3232
camera.setup_distortion_camera()
3333

3434

35+
func _input(event: InputEvent) -> void:
36+
if event.is_action_pressed("toggle_fullscreen"):
37+
OS.window_fullscreen = not OS.window_fullscreen
38+
get_tree().set_input_as_handled()
39+
40+
3541
func _on_Spawner_pirate_spawned(pirate: Node) -> void:
3642
pirate.register_on_map(map)
3743
pirate.setup_world_objects(_world_objects)

0 commit comments

Comments
 (0)