Skip to content

Commit

Permalink
Add support for toggling full-screen with F11
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanLovato committed Mar 5, 2020
1 parent ff0a553 commit d05ee97
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions project/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
6 changes: 6 additions & 0 deletions project/src/World/GameInitializer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d05ee97

Please sign in to comment.