Created
September 30, 2015 05:02
-
-
Save renpytom/ca9d6ba12c361be48685 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
| // Key events | |
| @Override | |
| public boolean onKey(View v, int keyCode, KeyEvent event) { | |
| // Dispatch the different events depending on where they come from | |
| // Some SOURCE_DPAD or SOURCE_GAMEPAD are also SOURCE_KEYBOARD | |
| // So, we try to process them as DPAD or GAMEPAD events first, if that fails we try them as KEYBOARD | |
| if (event.getAction() == KeyEvent.ACTION_DOWN) { | |
| //Log.v("SDL", "key down: " + keyCode); | |
| SDLActivity.onNativeKeyDown(keyCode); | |
| return true; | |
| } | |
| else if (event.getAction() == KeyEvent.ACTION_UP) { | |
| //Log.v("SDL", "key up: " + keyCode); | |
| SDLActivity.onNativeKeyUp(keyCode); | |
| return true; | |
| } | |
| return false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment