Commit graph

48 commits

Author SHA1 Message Date
Gabriel Jacobo
7ecccf3fbd Bug 1703 - SDL calls a wrong JNI function on Android by Philipp Wiesemann 2013-02-12 13:59:04 -03:00
Gabriel Jacobo
9e1dc0a80d Fixes potential global reference leak on Android, by Philipp Wiesemann 2013-01-27 21:43:20 -03:00
Gabriel Jacobo
09cbdb12c9 Fixes bug 1696, thanks Paul Geerts!
Also adds a bit of information about asset loading on Android.
2013-01-14 20:20:33 -03:00
Gabriel Jacobo
678523ea7c Android: Access APK files using AssetFileDescriptor 2013-01-08 09:30:53 -03:00
Gabriel Jacobo
070defcf11 Fix Audio Buffer allocation on Android >= 4.2 2013-01-07 12:22:26 -03:00
Sam Lantinga
b1185a32e3 Fixed bug 1616 - SDL does not use values set with SDL_GL_SetAttribute on Android
Philipp Wiesemann 2012-10-06 07:19:57 PDT

SDL does not use values set with SDL_GL_SetAttribute on Android.

I attached a patch which adds this functionality and makes it possible to set
(for example) depth buffer size or anti-aliasing in the actual application
instead of modifying the Java source (which seems currently the only way).
2012-12-31 14:57:36 -08:00
Sam Lantinga
e7b4458d8b Synchronized the on-screen keyboard state with whether we are accepting text input.
The functions to show/hide/toggle the on-screen keyboard have been folded into the text input state.
Calling SDL_StartTextInput() will automatically show the on-screen keyboard if it's available.
Calling SDL_StopTextInput() will automatically hide the on-screen keyboard if it's available.
There is a new API function SDL_IsTextInputActive() which will return whether text input is currently active.
Text input is disabled by default, you must call SDL_StartTextInput() when you are ready to accept text input.
SDL_HasScreenKeyboardSupport() no longer needs to be passed a window.
The iPhone-specific on-screen keyboard functions have been removed.
2012-11-04 21:53:28 -08:00
Sam Lantinga
2228e50b28 Whitespace cleanup 2012-11-04 20:20:53 -08:00
Sam Lantinga
dcc4ab558c Added information on running valgrind on Android 2012-11-04 13:49:32 -08:00
Sam Lantinga
9bd6a89040 Added an API to get the size of a file - WARNING! ABI CHANGE! 2012-11-03 18:43:36 -07:00
Sam Lantinga
ffc1360d69 Added some platform specific API functions for Android:
SDL_AndroidGetJNIEnv()
SDL_AndroidGetActivity()
SDL_AndroidGetInternalStoragePath()
SDL_AndroidGetExternalStorageState()
SDL_AndroidGetExternalStoragePath()
2012-11-02 02:22:32 -07:00
Sam Lantinga
14d82357b2 Need to use the new UCS-2-INTERNAL encoding for windows strings 2012-10-28 19:28:44 -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
Sam Lantinga
f380ecb137 Removed executable bit from source files 2012-09-27 14:35:28 -07:00
Sam Lantinga
ef6fa58028 Fixed bug 1573 - SDL does not support system clipboard on Android.
Philipp Wiesemann 2012-08-18 14:09:47 PDT

there is currently no way in SDL to interact with the system clipboard on
Android.

I attached a patch which tries to implement the three clipboard functions for
Android. It does not add the CLIPBOARDUPDATE event because this seems to
require Android API 11 or polling.
2012-09-26 20:14:37 -07:00
Sam Lantinga
82b0ec31cd Fixed bug 1606 - SDL does not implement SDL_GetPowerInfo() for Android.
Philipp Wiesemann 2012-09-22 05:26:11 PDT

currently SDL (HG) does not implement the power management functionality of
SDL_GetPowerInfo() for Android.

I attached a patch which tries to implement this functionality (JNI only, API
5). It supports plugged state and battery percent return values but not
remaining seconds (which are not available on Android).
2012-09-23 01:37:44 -07: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
Gabriel Jacobo
e4b5104b91 Fixes Android_JNI_FileRead behaviour where reading past the end of a file returns zero instead of the number of bytes read. 2012-07-20 15:22:48 -03:00
Gabriel Jacobo
8723c73510 Fixes #1422, removes global JNI Env, uses per thread copies, adds thread auto detaching. 2012-07-09 18:08:06 -03:00
Sam Lantinga
c7a5aa5128 Patrick Baggett implemented relative mouse mode on Win32
Here is my first rough attempt. "testrelative" feels right to me, but I'd like it someone else tested this, especially compared to Linux/OSX. The "Ctrl+r" to switch between relative and normal mouse movements seems to work flawlessly. With relative mouse movement, the only way to change focus is via keyboard. I'm not sure if that is the correct approach, but that would seem to be the most useful mode for games. Still, if my assumption is wrong, I can fix that no problem.
2012-07-03 23:52:02 -04:00
Gabriel Jacobo
28f32887a1 Fixes #1519, adds initialization to Android RWops internal variables. 2012-06-20 11:25:40 -03:00
Gabriel Jacobo
8fbd4fb107 Fixes #1422, restores GL context automatically under Android 2012-06-19 13:57:42 -03:00
Gabriel Jacobo
f6e83ac6a2 Fixes issue #1500 "SDL_RWops fails under Android 4" by removing stale Local Refs
and replacing them for their global equivalents.
2012-05-25 15:35:41 -03:00
Gabriel Jacobo
4576303b58 Fix for issue #1465, Leak in Android_JNI_SetActivityTitle (SDL_SetWindowTitle)
Thanks Martin Gerhardy!
2012-05-25 15:10:13 -03:00
Sam Lantinga
9514b6a286 Fixed bug 1417 - Android_JNI_FileClose local reference bug
A better solution for automatic local reference management.
2012-02-12 20:57:32 -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
d3ab037501 Made the application activity events consistent between iOS and Android 2012-01-08 13:42:03 -05:00
Tim Angus
73b21090a2 * Take a global reference to the activity to prevent the reference being GCed 2011-08-26 13:23:40 +01: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
Sam Lantinga
028e5dcdbd Happy New Year! 2011-12-31 09:28:07 -05:00
Sam Lantinga
ad2a21d404 Lots of fixes importing SDL source wholesale into a new iOS project
--HG--
rename : src/libm/math.h => src/libm/math_libm.h
2011-10-31 05:56:58 -04:00
Ryan C. Gordon
61d3a02eab Don't bother checking S_OK here, it'll work in falling through. 2011-10-26 12:04:05 -04:00
Ryan C. Gordon
3f0781af54 Don't use a global JNIEnv across threads; it's not thread safe.
Obtain the correct environment in a thread-safe way when appropriate instead.

Fixes Bugzilla #1312.

Thanks to Bill Chenbin for the patch!
2011-10-15 23:50:06 -07:00
Ryan C. Gordon
bba4029d9b Removed STL dependency in Android code. 2011-10-15 14:16:29 -07:00
Tim Angus
aa76adf490 * Android's InputStream::skip is apparently buggy, so instead read into a dummy buffer 2011-10-14 17:29:49 +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
Ryan C. Gordon
a622e7c305 Called method on wrong object in Android exception handler.
Fixes Bugzilla #1297.

Thanks to jon @ rafkind for the patch!
2011-09-01 04:42:09 -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
e42ca42e76 Removed some Windows endlines. 2011-08-04 01:36:23 -04:00
Ryan C. Gordon
8fa65eea5c Cleaned up CoInitialize() politics on Windows. 2011-08-03 04:22:47 -04: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
b0660ba5ff SDL 1.3 is now under the zlib license. 2011-04-08 13:03:26 -07:00
Sam Lantinga
c9e8ff608c Fixed permissions for C header files 2011-03-11 11:53:09 -08:00
Sam Lantinga
baf813b8c1 Our minimum Windows version is Windows 2000, so it's okay to directly call InitializeCriticalSectionAndSpinCount().. 2011-02-17 09:26:15 -08:00
Sam Lantinga
e5803d148c Happy 2011! :) 2011-02-11 22:37:15 -08: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
ada074623f Fixed Android build 2011-01-24 21:31:32 -08:00
Sam Lantinga
b4497865bd Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
I think this also fixes the bug relating to non-latin characters in filenames, since UNICODE wasn't defined in SDL_rwops.c

--HG--
rename : src/SDL_android.cpp => src/core/android/SDL_android.cpp
rename : src/SDL_android.h => src/core/android/SDL_android.h
2011-01-24 21:20:30 -08:00