Merge branch 'sdl_android' of github.com:pelya/commandergenius into sdl_android

This commit is contained in:
Sergii Pylypenko
2015-03-20 18:54:36 +02:00
8 changed files with 28 additions and 9 deletions

View File

@@ -62,6 +62,7 @@ import android.app.AlarmManager;
import android.content.Intent;
import android.view.View;
import android.view.Display;
import android.net.Uri;
class Mouse
@@ -914,6 +915,11 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
return ret;
}
public void openExternalWebBrowser(String url)
{
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}
private int PowerOf2(int i)
{

View File

@@ -7,10 +7,10 @@ AppName="OpenTTD"
AppFullName=org.openttd.sdl
# Application version code (integer)
AppVersionCode=14436
AppVersionCode=14437
# Application user-visible version name (string)
AppVersionName="1.4.4.36"
AppVersionName="1.4.4.37"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
@@ -18,7 +18,7 @@ AppVersionName="1.4.4.36"
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by build system
# You can specify Google Play expansion files in the form 'obb:main.12345' or 'obb:patch.12345' where 12345 is the app version, first associated with the file
AppDataDownloadUrl="!!Data files - 20 Mb|openttd-data-1.4.4.zip.xz|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/openttd-data-1.4.4.zip.xz^!!Config file|:.openttd/openttd.cfg:openttd-1.4.0.30.cfg^!MIDI music support (18 Mb)|timidity.zip.xz|http://sourceforge.net/projects/libsdl-android/files/timidity.zip.xz^!!Internationalization files|icudt52l.zip.xz|http://sourceforge.net/projects/libsdl-android/files/icudt52l.zip.xz"
AppDataDownloadUrl="!!Data files - 20 Mb|openttd-data-1.4.4-1.zip.xz|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/openttd-data-1.4.4-1.zip.xz^!!Config file|:.openttd/openttd.cfg:openttd-1.4.0.30.cfg^!MIDI music support (18 Mb)|timidity.zip.xz|http://sourceforge.net/projects/libsdl-android/files/timidity.zip.xz^!!Internationalization files|icudt52l.zip.xz|http://sourceforge.net/projects/libsdl-android/files/icudt52l.zip.xz"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=n
@@ -223,7 +223,7 @@ NDK_TOOLCHAIN_VERSION=
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
# Available architectures: armeabi armeabi-v7a armeabi-v7a-hard x86 mips
MultiABI='armeabi-v7a'
MultiABI='armeabi-v7a x86'
# Optional shared libraries to compile - removing some of them will save space
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed

View File

@@ -1,6 +1,6 @@
#!/bin/sh
VER=1.4.4
VER=1.4.4-1
cd data
rm -f ../AndroidData/openttd-data-*.zip.xz ../AndroidData/openttd-data-*.zip

View File

@@ -118,6 +118,9 @@ Returns 1 if load succeeded, 0 if user aborted sign-in, or there was no network
*/
extern DECLSPEC int SDLCALL SDL_ANDROID_CloudLoad(const char *filename, const char *saveId, const char *dialogTitle);
/* Open an Android web browser, or Chrome, or Youtube for video links */
extern DECLSPEC void SDLCALL SDL_ANDROID_OpenExternalWebBrowser(const char *url);
#ifdef __cplusplus
}
#endif

View File

@@ -84,6 +84,7 @@ static jmethodID JavaSetAdvertisementPosition = NULL;
static jmethodID JavaRequestNewAdvertisement = NULL;
static jmethodID JavaRequestCloudSave = NULL;
static jmethodID JavaRequestCloudLoad = NULL;
static jmethodID JavaRequestOpenExternalWebBrowser = NULL;
static int glContextLost = 0;
static int showScreenKeyboardDeferred = 0;
static const char * showScreenKeyboardOldText = "";
@@ -355,6 +356,7 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInitJavaCallbacks) ( JNIEnv* env, jobject t
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;J)Z");
JavaRequestCloudLoad = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "cloudLoad",
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z");
JavaRequestOpenExternalWebBrowser = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "openExternalWebBrowser", "(Ljava/lang/String;)V");
ANDROID_InitOSKeymap();
}
@@ -569,6 +571,14 @@ int SDLCALL SDL_ANDROID_CloudLoad(const char *filename, const char *saveId, cons
return result;
}
void SDLCALL SDL_ANDROID_OpenExternalWebBrowser(const char *url)
{
(*JavaEnv)->PushLocalFrame(JavaEnv, 1);
jstring s1 = (*JavaEnv)->NewStringUTF(JavaEnv, url);
(*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaRequestOpenExternalWebBrowser, s1 );
(*JavaEnv)->DeleteLocalRef(JavaEnv, s1);
(*JavaEnv)->PopLocalFrame(JavaEnv, NULL);
}
// Dummy callback for SDL2 to satisfy linker
extern void SDL_Android_Init(JNIEnv* env, jclass cls);

View File

@@ -35,6 +35,6 @@ TODO, which will get actually done
- S Planner Killer: options to restore calendar settiongs, and to kill lock-screen widget.
- OpenTTD: tutorial.
- OpenTTD: 24bpp color mode + 32bpp blitter in SDL menu.
- OpenTTD: text input freezes OpenTTD and servers kick it.