Skip to content

Instantly share code, notes, and snippets.

@savage69kr
Forked from cambiata/gist:3673008
Created April 1, 2013 14:23
Show Gist options
  • Select an option

  • Save savage69kr/5285214 to your computer and use it in GitHub Desktop.

Select an option

Save savage69kr/5285214 to your computer and use it in GitHub Desktop.
/**
* ...
* @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