-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from zibetnu/hide-mouse
Hide and ignore mouse when detecting Joypad input
- Loading branch information
Showing
4 changed files
with
40 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
extends Node | ||
|
||
|
||
const ACTIVE_MODE = Input.MOUSE_MODE_CONFINED | ||
const INACTIVE_MODE = Input.MOUSE_MODE_HIDDEN | ||
|
||
|
||
func _ready() -> void: | ||
Input.set_mouse_mode(INACTIVE_MODE) | ||
|
||
|
||
func _input(event: InputEvent) -> void: | ||
if event is InputEventMouseMotion: | ||
Input.set_mouse_mode(ACTIVE_MODE) | ||
|
||
elif event is InputEventJoypadButton or event is InputEventJoypadMotion: | ||
Input.set_mouse_mode(INACTIVE_MODE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters