comparison android/src/org/libsdl/app/SDLActivity.java @ 903:0e5f9d6135be

Make nexus player remote useable as a controller for games that only require a dpad + start + c. Use warning() instead of fprintf(stder,...) in io.c
author Michael Pavone <pavone@retrodev.com>
date Sat, 28 Nov 2015 14:30:30 -0800
parents 09f5a349e881
children 78abbabfd58d
comparison
equal deleted inserted replaced
902:6011409ded0d 903:0e5f9d6135be
670 public boolean onKey(View v, int keyCode, KeyEvent event) { 670 public boolean onKey(View v, int keyCode, KeyEvent event) {
671 // Dispatch the different events depending on where they come from 671 // Dispatch the different events depending on where they come from
672 // Some SOURCE_DPAD or SOURCE_GAMEPAD are also SOURCE_KEYBOARD 672 // Some SOURCE_DPAD or SOURCE_GAMEPAD are also SOURCE_KEYBOARD
673 // So, we try to process them as DPAD or GAMEPAD events first, if that fails we try them as KEYBOARD 673 // So, we try to process them as DPAD or GAMEPAD events first, if that fails we try them as KEYBOARD
674 674
675 if ( (event.getSource() & 0x00000401) != 0 || /* API 12: SOURCE_GAMEPAD */ 675 if ( (event.getSource() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
676 (event.getSource() & InputDevice.SOURCE_DPAD) != 0 ) {
677 if (event.getAction() == KeyEvent.ACTION_DOWN) { 676 if (event.getAction() == KeyEvent.ACTION_DOWN) {
678 if (SDLActivity.onNativePadDown(event.getDeviceId(), keyCode) == 0) { 677 if (SDLActivity.onNativePadDown(event.getDeviceId(), keyCode) == 0) {
679 return true; 678 return true;
680 } 679 }
681 } else if (event.getAction() == KeyEvent.ACTION_UP) { 680 } else if (event.getAction() == KeyEvent.ACTION_UP) {