Commit graph

27 commits

Author SHA1 Message Date
Sam Lantinga
8e886bcdeb Cleaned up OpenGL initialization a bit so we fail if we can't create a surface. 2012-11-04 08:51:43 -08:00
Sam Lantinga
0b1b6adb77 Updated the Android project template and README.android
Added information on how to customize your application name and icon.
Added information on using STL with an Android application
Increased the minimum API level to 10, because that's the lowest API
that currently has an emulator image for testing.
2012-11-02 02:37:49 -07:00
Sam Lantinga
e6c0215444 Fixed bug 1614 - SDL for Android does not implement TextInput API
Andrey Isakov 2012-10-03 08:30:25 PDT

I've found out in the process of porting one OS project to Android/SDL2 that
there is no support for TextInput events/APIs on Android.
So I implemented some kind of initial support of that feature, and at the very
least it seems to work fine with latin chars input with soft and hardware
keyboards on my Moto Milestone2. I've also tried playing around with more
complex IMEs, like japanese, logging the process and it seemed to work too. I'm
not sure since the app itself I am working on does not have support for
non-latin input.

The main point of the patch is to place a fake input view in the region
specified by SDL_SetTextInputRect and create a custom InputConnection for it.
The reason to make it a separate view is to support Android's pan&scan on input
feature properly. For details please refer to
http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html
Even though the manual states that SetTextInputRect is used to determine the
IME variants position, I thought this would be a proper use for this too.
2012-10-03 20:49:16 -07:00
Gabriel Jacobo
052e84a94b Fixes bug #1506, Changing orientation on the Android device throws off touch scaling 2012-08-24 13:10:29 -03:00
Sam Lantinga
bf2304785f Fixed bug 1564 - SDL has no function to open a screen keyboard on Android.
Philipp Wiesemann implemented a general on-screen keyboard API for SDL, and I switched iOS code over to use it.
2012-08-11 10:15:59 -07:00
Ryan C. Gordon
4b61576aec Make Android port compatible with older API versions again.
Fixes Bugzilla #1563.

Thanks to Philipp Wiesemann for the patch!
2012-08-03 23:59:05 -04:00
Gabriel Jacobo
7a1361b538 Fix Android's SDLActivity for devices that may send more than one surfaceChanged
event in a row (ie, the Kindle Fire)
2012-06-24 21:10:17 -03:00
Gabriel Jacobo
8fbd4fb107 Fixes #1422, restores GL context automatically under Android 2012-06-19 13:57:42 -03:00
Sam Lantinga
84a5ad6d06 Updated the Android Java activity for SDL2 2012-02-04 16:39:52 -05:00
Sam Lantinga
40c6294290 Fixed bug 1368 - Enabling joystick subsystem cause an infinite loop
morgan.devel@gmail.com 2012-01-13 00:32:23 PST

The android version of SDL_SYS_JoystickUpdate doesn't check if there is
actually new data and always generate the SDL_JOYAXISMOTION event.
Consequently, doing a while(SDL_PollEvent()) will result in an endless loop.

The attached patch fix this issue.

It also scale the incoming values properly in the Sint16 range. The scale from
[-gravity;+gravity] is done directly in the java part because one may want to
map the sensor values with a non-linear method for example.
2012-01-13 20:57:35 -05:00
Sam Lantinga
64d81471d8 Fixed bug 1293 - [Android] Support Pause/Resume
Gabriel Jacobo 2011-12-23 12:55:11 PST

The attached files provide some improvement over the current handling of
pause/resume in Android.
- I disabled the exit(status) instruction in SDL_main as that makes the entire
app instead of the SDL thread exit (while not needed for pause/resume it is
needed for Live Wallpapers, an SDLActivity for which I'll upload in a separate
bug).
- Added nativePause and nativeResume which basically just mark the window as
visible/hidden, something that the end user needs to take into consideration
(ideally pausing the event loop).

Also, this arrangement creates a new GL context when needed, which at least in
my test system is every time you go away from the app and come back to it. So,
this means that the textures need to be generated again after resuming (a
problem the end user didn't have before because the app exited completely when
it should've been pausing). I'd like to know if there's a standard way of
letting the user know that the GL context has changed and that he needs to
refresh his textures, or if this is out of the scope of the library and each
user handles it in their own way (I don't know how/if this same thing is
handled in  the iPhone backend, but it would be wise to try to imitate that).

Gabriel Jacobo 2011-12-23 12:57:10 PST
Also, in the SDLActivity the EGL handling code is moved up to the Activity from
the Surface code, as I think it is possible (in theory) that the surface is
destroyed temporarily while the context remains alive (though in practice in my
test system this is not the case)
2012-01-08 01:05:25 -05:00
Tim Angus
578cd935a0 * Support OpenGL ES 2 on Android 2011-08-26 13:15:05 +01:00
Ryan C. Gordon
62176df129 Added support for multitouch on Android.
Fixes Bugzilla #1294.

Thanks to Gabriel Jacobo for the patch!
2011-10-13 01:21:35 -04:00
Tim Angus
6f0f508a4f * Fix many memory leaks in Android FS code
* Set SDL error string with Java exception details when one occurs
* Fix tabulation of SDLActivity::getContext
2011-08-26 13:11:53 +01:00
Ryan C. Gordon
247346d526 Allow Android platforms to read from .apk files via the RWOPS interface.
Fixes Bugzilla #1261.

Thanks to Tim Angus for the patch!
2011-07-29 16:51:25 -04:00
Sam Lantinga
9127589299 Try to create an OpenGL ES 2.0 context on Android and successfully fall back to OpenGL ES 1.1 if that fails. 2011-02-07 17:44:07 -08:00
Sam Lantinga
9fa1d4876d The window is changed to reflect the actual screen dimensions, for now.
Implemented SDL_SetWindowTitle(), which turned out to be fairly complex
2011-01-13 15:10:17 -08:00
Sam Lantinga
5b1882ee17 Fixed audio buffer lifecycle and implemented audio shutdown 2011-01-13 12:32:55 -08:00
Sam Lantinga
4f9db82a4c Working audio implementation contributed by Joseph Lunderville 2011-01-13 11:14:20 -08:00
Sam Lantinga
738f971adb Implemented translation from Android keycodes to SDL scancodes 2011-01-12 21:21:21 -08:00
Sam Lantinga
27dd18d80a Fixed video mode format for unknown surface format 2011-01-12 19:33:29 -08:00
Sam Lantinga
0fa1d9fe61 More Android cleanup:
* Formalized the interface with Java methods in SDL_android.h
* We don't need the feature system, at least right now
* Fixed waiting for the SDLMain thread
2011-01-12 17:53:06 -08:00
Sam Lantinga
f9f37e83fe Whoops, need to pass that SDL format into native code 2011-01-12 16:35:03 -08:00
Sam Lantinga
fdea37a756 Added some missing pixel formats and SDL_GetPixelFormatName() 2011-01-12 14:53:23 -08:00
Sam Lantinga
25101525df Fill in the video mode with the correct screen format 2011-01-12 14:29:01 -08:00
Sam Lantinga
a410db1ae6 A bit of cleanup in the Android driver 2011-01-12 13:52:41 -08:00
Sam Lantinga
b674add868 Added the Android project and lots of info to README.android 2011-01-06 17:12:31 -08:00