-
-
Save savage69kr/5285214 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /** | |
| * ... | |
| * @author Jonas Nyström | |
| */ | |
| class KeyboardTools { | |
| /** | |
| * Targeting neko and windows, this method returns the sam keycodes for | |
| * letters a-z and the numeric keyboard as when targeting flash/html5 | |
| */ | |
| static public function getKeyCode(e:KeyboardEvent) { | |
| var keyCode = e.keyCode; | |
| #if (neko || cpp) | |
| if (e.keyCode == e.charCode) | |
| if (keyCode >= 65 && keyCode <= 122) { | |
| keyCode = keyCode-32; | |
| } | |
| #end | |
| return keyCode; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment