android-project/src


Log

Author Commit Date CI Message
Gabriel Jacobo 0b7c69fe 2013-11-05T20:07:39 Adds Joystick support for Android This bumps the build SDK level to 12 (up from 10). Runtime requirements remain the same (at API level < 12 joystick support is disabled). Also enables building SDL for armv7 and x86.
Sam Lantinga 5697089d 2013-10-20T23:52:02 Fixed bug 2156 - Android: Accelerometer values fed to joystick driver are inverted for the X axis and wrong for Z Denis Bernard Background information: http://developer.android.com/reference/android/hardware/SensorEvent.html#values Steps to reproduce: compile testjoystick.c as an android app (change screen size according to your device). While running the app, also run: adb logcat -c; adb logcat -s 'SDL:*' 'SDL/APP:*' When tilting the device left/right, the joystick moves in the opposite direction of what one would expect. Or at least, the behaviour is not consistent with the Y axis. Also when the device sits on a table (obviously not moving), the Z axis value oscillates between -32000 and +32000 (by overflow): I/SDL/APP ( 1994): Joystick 0 axis 2 value: 32511 I/SDL/APP ( 1994): Joystick 0 axis 2 value: 32575 I/SDL/APP ( 1994): Joystick 0 axis 2 value: 32383 I/SDL/APP ( 1994): Joystick 0 axis 2 value: -32386 I/SDL/APP ( 1994): Joystick 0 axis 2 value: -32450 I/SDL/APP ( 1994): Joystick 0 axis 2 value: -32578 This is caused by the accelerometer yielding a constant value around 9.81 for Z and feeding something like 0.9 to 1.1 to the joystick driver, resulting in the overflow. Proposed fix in SDLActivity.java (swap X and subtract G from Z reading)
Sam Lantinga 7ae171d1 2013-10-17T23:44:30 Fixed bug 2155 - automatically remap accelerometer coordinates according to screen orientation on Android Denis Bernard Background information: http://android-developers.blogspot.fr/2010/09/one-screen-turn-deserves-another.html and http://developer.android.com/reference/android/hardware/SensorEvent.html Right now, the Android accelerometer event handler feeds raw accelerometer data to the SDL Joystick driver. The result is that for landscape-only applications, the axis need to be swapped if running on a portrait device (like a phone), and vice-versa: running a portrait only app on a landscape device like a tablet. The purpose of this patch is to perform coordinate remapping of the accelerometer data before feeding it to the SDL joystick driver so that the X axis of the joystick is always aligned with the X axis of the display, same for the Y axis. This has been tested on applications that support screen orientation changes as well as applications with fixed screen orientations, both on phones and tablets.
Philipp Wiesemann 0db36f51 2013-10-05T17:08:19 Added detection of touch devices before first touch events happen on Android. On Android available touch devices are now added with video initialization (like the keyboard). This fixes SDL_GetNumTouchDevices() returning 0 before any touch events happened although there is a touch screen available. The adding of touch devices after a touch event was received is still active to allow connecting devices later (if this is possible) and to provide a fallback if the new init did not work somehow. For the implementation JNI was used and API level 9 is required. There seems to be nothing in the Android NDK's input header (input.h) to implement everything on C side without communication with Java side.
Gabriel Jacobo cc122ce5 2013-08-22T10:22:22 Fixes #2036 and #2038, bypass camera zoom and shutter keypresses on Android.
Gabriel Jacobo 0eeb76d8 2013-08-19T16:29:46 Fixes bug #2037, common EGL code for Android and X11
Gabriel Jacobo dad42067 2013-08-12T11:13:50 Fixes #2022, do not resume on Android when surfaceChanged If the app is in landscape mode and the user presses the power button, a pause is followed immediately by a surfaceChanged event because the lock screen is shown in portrait mode. This triggers a "false" resume. So, we just pause and resume following the onWindowFocusChanged events. Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before blocking the event pump.