-
-
Notifications
You must be signed in to change notification settings - Fork 5
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 #2 from kyubuns/NewInputSystemSupport
New input system support
- Loading branch information
Showing
10 changed files
with
134 additions
and
19 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
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,69 @@ | ||
#if NEW_INPUT_SYSTEM_SUPPORT | ||
using UnityEngine.InputSystem; | ||
using UnityEngine.InputSystem.Controls; | ||
#else | ||
using UnityEngine; | ||
#endif | ||
|
||
namespace AbcConsole.Internal | ||
{ | ||
public static class KeyInput | ||
{ | ||
#if NEW_INPUT_SYSTEM_SUPPORT | ||
public static bool GetKeyDown(string keyCode) | ||
{ | ||
return ((KeyControl) Keyboard.current[keyCode]).wasPressedThisFrame; | ||
} | ||
#else | ||
public static bool GetKeyDown(KeyCode keyCode) | ||
{ | ||
return Input.GetKeyDown(keyCode); | ||
} | ||
#endif | ||
|
||
public static bool GetEscapeKeyDown() | ||
{ | ||
#if NEW_INPUT_SYSTEM_SUPPORT | ||
return Keyboard.current.escapeKey.wasPressedThisFrame; | ||
#else | ||
return Input.GetKeyDown(KeyCode.Escape); | ||
#endif | ||
} | ||
|
||
public static bool GetReturnKeyDown() | ||
{ | ||
#if NEW_INPUT_SYSTEM_SUPPORT | ||
return Keyboard.current.enterKey.wasPressedThisFrame; | ||
#else | ||
return Input.GetKeyDown(KeyCode.Return); | ||
#endif | ||
} | ||
|
||
public static bool GetTabKeyDown() | ||
{ | ||
#if NEW_INPUT_SYSTEM_SUPPORT | ||
return Keyboard.current.tabKey.wasPressedThisFrame; | ||
#else | ||
return Input.GetKeyDown(KeyCode.Tab); | ||
#endif | ||
} | ||
|
||
public static bool GetUpArrowKeyDown() | ||
{ | ||
#if NEW_INPUT_SYSTEM_SUPPORT | ||
return Keyboard.current.upArrowKey.wasPressedThisFrame; | ||
#else | ||
return Input.GetKeyDown(KeyCode.UpArrow); | ||
#endif | ||
} | ||
|
||
public static bool GetDownArrowKeyDown() | ||
{ | ||
#if NEW_INPUT_SYSTEM_SUPPORT | ||
return Keyboard.current.downArrowKey.wasPressedThisFrame; | ||
#else | ||
return Input.GetKeyDown(KeyCode.DownArrow); | ||
#endif | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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