Commit Graph

68 Commits

Author SHA1 Message Date
Gabriel Jacobo
8ebc49587f Consider the case where an attribute is set to EGL_DONT_CARE in eglChooseConfig
SDL doesn't currently use EGL_DONT_CARE, but it doesn' hurt to future proof.
2013-07-26 12:37:36 -03:00
Gabriel Jacobo
77cacb8357 [Android] Bug 1827, select the best matching config provided by eglChooseConfig 2013-07-26 12:22:40 -03:00
Eric Wing
03cc44af03 Android: Removed all unnecessary dependencies on C++.
C++ is a bit of a minefield on Android. Much functionality still doesn't work, and Android can't decide on which C++ standard library to use, so it provides 3 different ones, all of which are incompatible with each other. (It looks like clang is coming too which will add a new compiler and a 4th standard library.)

As middleware, SDL might be distributed as a binary and intermixed with other projects already using C++. If C++ is intermixed in a bad way, bad things will happen. Removing dependencies on C++ will avoid this problem and downstream users won't have to worry/care.
2013-07-22 02:51:45 -07:00
Gabriel Jacobo
93274d6d53 Adds Input Focus handling on Android to improve pausing/resuming behavior
Ref: http://android-developers.blogspot.com/2011/11/making-android-games-that-play-nice.html
2013-07-09 10:25:16 -03:00
Gabriel Jacobo
fe40941788 Fixes Bug 1896 - Android app is running while the screen is locked
Original patch by ny00@outlook.com
2013-07-06 15:22:49 -03:00
Philipp Wiesemann
1e57fbb3ea Updated names of README files in source comments. 2013-06-09 11:58:31 +02:00
Philipp Wiesemann
ace9a18a3d Fixed Android Lint warning in AndroidManifest.xml.
If targetSdkVersion not set it becomes same as minSdkVersion and causes warning.
2013-06-09 11:51:59 +02:00
Philipp Wiesemann
0122ce66f8 Added deactivated loading of SDL2_net to Java file. 2013-05-30 12:23:36 +02:00
Sam Lantinga
3beb70c4bc Added mobile application events, with implementations for iOS and Android 2013-05-18 12:48:50 -07:00
Philipp Wiesemann
23dad5b9c7 Corrected comment in Java file. 2013-05-18 14:04:37 +02:00
Philipp Wiesemann
1cdf7f6988 Changed import statements in Java file. 2013-05-18 14:03:45 +02:00
Sam Lantinga
f14452ed24 There's no need to keep these private. If you extend SDLActivity, you should know what you're doing. 2013-05-15 23:18:29 -07:00
Philipp Wiesemann
f67a75ebbb Fixed Android Lint warning in AndroidManifest.xml. 2013-05-10 21:19:40 +02:00
Philipp Wiesemann
2cba589334 Removed not needed block from Java file. 2013-05-05 16:01:19 +02:00
Philipp Wiesemann
b6c14af95e Changed signatures of methods in Java file to return boolean, adapted C++ file.
This way more checking for errors is possible which is currently not done here.
2013-05-05 15:54:56 +02:00
Philipp Wiesemann
1773e82524 Changed signature of method recently added in Java file. 2013-05-05 15:50:21 +02:00
Philipp Wiesemann
6bf81bca0b Added a method in Java file which may be overridden for custom messages. 2013-05-05 12:53:57 +02:00
Philipp Wiesemann
daf329ee15 Fixed possible leak and its Android Lint warning in Java file. 2013-05-05 12:50:34 +02:00
Philipp Wiesemann
1f697948fd Removed not needed casts from Java file. 2013-04-27 17:23:20 +02:00
Philipp Wiesemann
b281192487 Removed not needed import statements from Java file. 2013-04-27 17:17:37 +02:00
Philipp Wiesemann
7edda57b2d Removed dead store from Java file because value never used. 2013-04-27 17:15:40 +02:00
Philipp Wiesemann
0ef57149cc Renamed inner class in Java file to avoid confusion with an unrelated class. 2013-04-27 17:10:14 +02:00
Philipp Wiesemann
881b76836e Changed Java source file to use constant from API instead of just a String. 2013-04-27 14:26:15 +02:00
Philipp Wiesemann
420b355303 Added missing @Override annotations in Java source file to reduce warnings. 2013-04-27 14:13:30 +02:00
Philipp Wiesemann
a94cf44b93 Corrected a comment in Java source file. 2013-04-27 13:33:05 +02:00
Gabriel Jacobo
4881297e05 Fix for bug #1776 by Jonathan Dearborn 2013-04-19 14:40:39 -03:00
Sam Lantinga
d7e7bfe9ad Fixed bug 1779 - SDL's Android project template has old default icons from Android.
Philipp Wiesemann

SDL's Android project template has old default icons from Android while iOS project template has custom icons with SDL's logo.

There is a Wizard in the Android Developer Tools to create "Android Icon Sets". As an example I created icons from the iOS loading screen and attached them in a ZIP archive. They are named "ic_launcher.png" instead of "icon.png" because that is the new name used in Android projects. To use them the AndroidManifest.xml needs to be changed to have "@drawable/ic_launcher" instead of "@drawable/icon". I do not know why there was no icon created for ldpi. Maybe it is deprecated.
2013-04-02 07:55:25 -07:00
Gabriel Jacobo
b19f55242a Backed out changeset: 9cef1005df5f 2013-04-01 13:20:22 -03:00
Sam Lantinga
91094c910e Fixed bug 1700 - Joysticks not supported in Android 2013-03-19 23:03:57 -07:00
Gabriel Jacobo
639d80667e Fixes AndroidManifest comment, Android API level 10 = Android 2.3.3 2013-03-04 10:39:21 -03:00
Sam Lantinga
ab93f37976 Fixed bug 1740 - Android pixel format constants out of sync
wjp

In SDL HG (2.0) the pixel format constants in
android-project/src/org/libsdl/app/SDLActivity.java seem to have gone out of
sync with include/SDL_pixels.h in HG rev b1124b32b07d.

E.g., at a glance it seems like 0x85151002 should have become 0x15151002.
2013-03-03 21:52:51 -08:00
Sam Lantinga
a65e5a3850 Removed local.properties from android-project folder
Alexey Petruchik

Please remove local.properties from android-project folder and add it to hgignore
According to the local.properties:
# This file must *NOT* be checked in Version Control Systems,
2013-02-23 02:25:34 -08:00
Sam Lantinga
9da7324da4 Fixed bug 1711 - Comment in "manifest" element within android-project/AndroidManifest.xml is the source of troubles
ny00@outlook.com

Let me quote the following opening tag from
android-project/AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    <!-- Replace org.libsdl.app with the identifier of your game, e.g.
         com.gamemaker.game
     -->
      package="org.libsdl.app"
      android:versionCode="1"
      android:versionName="1.0"
      android:installLocation="auto">

The comment (with the text "Replace org.libsdl.app with...") seems to be a
cause of troubles. Here are a few examples I've spotted:

1) While using nkd-build from android-ndk-r8d, I receive the following error:

Invalid attribute name: <!-- replace org.libsdl.app with the identifier of your
game, e.g.
         com.gamemaker.game
     --
/home/ny00123/util/android-ndk-r8d/build/gmsl/__gmsl:512: *** non-numeric
second argument to `wordlist' function: ''.  Stop.

2) Repeating this but with android-ndk-r6b (an earlier revision), it reduces to
a warning and actual complication is not halted.

3) Following the instructions in README.android and using Eclipse (from a
recently downloaded ADT Bundle), I cannot seem to be able to create an Android
project from existing sources (one of the SDL test apps for now).
* On a side note, I can't find where I may choose the "Build Target" before
clicking "Finish", but it does not seem to be related to this bug report.
Anyway, following the choice of the project path and a click on "Finish",
nothing seems to occur.
If I rather do so after removing the above comment from AndroidManifest.xml,
though, the project appears on Eclipse as expected once I click on "Finish".
2013-02-08 01:12:48 -08:00
Gabriel Jacobo
11e188634e #1702,Android soft keyboard fails to pass all input, by Jonathan Dearborn 2013-01-26 12:31:55 -03:00
Gabriel Jacobo
06cac2693e Fixed SDLActivity::audioInit return type, thanks Andreas! 2013-01-08 08:28:39 -03:00
Gabriel Jacobo
69acbe58d2 Fix Audio Buffer allocation on Android >= 4.2 2013-01-07 12:22:26 -03:00
Sam Lantinga
94ec418971 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
9e89faaf15 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
48fe3e9f09 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
f7f237c125 Simplified the manifest a little - we don't need a Java class in there. :) 2012-11-02 03:03:55 -07:00
Sam Lantinga
94ca45bd69 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
38732d0a49 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
f5b7a7d7db Fixes bug #1506, Changing orientation on the Android device throws off touch scaling 2012-08-24 13:10:29 -03:00
Sam Lantinga
e6d37e6522 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
d20ba4537e 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
95b70995ba 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
1be4f2c07f Fixes #1422, restores GL context automatically under Android 2012-06-19 13:57:42 -03:00
Sam Lantinga
608641e290 Quick android Makefile fix from Gabriel Jacobo 2012-02-14 20:54:44 -05:00
Sam Lantinga
4f291e8eae Updated the Android Java activity for SDL2 2012-02-04 16:39:52 -05:00
Sam Lantinga
a1d5bd8db6 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