Fixed SDL 1.3 compilation

This commit is contained in:
pelya
2011-03-18 11:39:00 +02:00
parent 9fbb3b22a2
commit 21bf45e9ef
4 changed files with 21 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
# The application settings for Android libSDL port
AppSettingVersion=16
AppSettingVersion=17
LibSdlVersion=1.3
AppName="Alien Blaster"
AppFullName=de.schwardtnet.alienblaster
@@ -9,6 +9,7 @@ AppDataDownloadUrl="!Game data|alienblaster110_data1.zip^!Game data|alienblaster
SdlVideoResize=y
SdlVideoResizeKeepAspect=n
NeedDepthBuffer=n
SwVideoMode=n
AppUsesMouse=n
AppNeedsTwoButtonMouse=n
AppNeedsArrowKeys=y
@@ -29,6 +30,5 @@ CustomBuildScript=n
AppCflags='-O3'
AppLdflags=''
AppSubdirsBuild=''
AppUseCrystaXToolchain=n
AppCmdline=''
ReadmeText='^You can press "Home" now - the data will be downloaded in background^In game press "Menu" for secondary fire, "Volume Up/Down" to cycle weapons'

View File

@@ -1 +1 @@
ufoai
alienblaster

View File

@@ -618,6 +618,13 @@ void ProcessDeferredMouseTap()
deferredMouseTap--;
if( deferredMouseTap <= 0 )
{
#if SDL_VERSION_ATLEAST(1,3,0)
SDL_Window * window = SDL_GetFocusWindow();
if( !window )
return;
#define SDL_ANDROID_sFakeWindowWidth window->w
#define SDL_ANDROID_sFakeWindowHeight window->h
#endif
if( oldMouseX + 1 < SDL_ANDROID_sFakeWindowWidth )
SDL_ANDROID_MainThreadPushMouseMotion(oldMouseX + 1, oldMouseY);
SDL_ANDROID_MainThreadPushMouseButton( SDL_RELEASED, SDL_BUTTON_LEFT );

View File

@@ -5,6 +5,7 @@
#include <limits.h>
#include <jni.h>
#include <android/log.h>
#include "SDL_version.h"
#include "SDL_thread.h"
#include "SDL_main.h"
@@ -24,18 +25,21 @@
#define JAVA_EXPORT_NAME1(name,package) JAVA_EXPORT_NAME2(name,package)
#define JAVA_EXPORT_NAME(name) JAVA_EXPORT_NAME1(name,SDL_JAVA_PACKAGE_PATH)
extern void SDL_ANDROID_MultiThreadedVideoLoopInit();
extern void SDL_ANDROID_MultiThreadedVideoLoop();
static int argc = 0;
static char ** argv = NULL;
#if SDL_VERSION_ATLEAST(1,3,0)
#else
extern void SDL_ANDROID_MultiThreadedVideoLoopInit();
extern void SDL_ANDROID_MultiThreadedVideoLoop();
static int threadedMain(void * unused)
{
SDL_main( argc, argv );
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Application closed, calling exit(0)");
exit(0);
}
#endif
extern C_LINKAGE void
JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz, jstring jcurdir, jstring cmdline, jint multiThreadedVideo )
@@ -97,6 +101,9 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz, jstring
for( i = 0; i < argc; i++ )
__android_log_print(ANDROID_LOG_INFO, "libSDL", "param %d = \"%s\"", i, argv[i]);
#if SDL_VERSION_ATLEAST(1,3,0)
SDL_main( argc, argv );
#else
if( ! multiThreadedVideo )
SDL_main( argc, argv );
else
@@ -105,6 +112,7 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz, jstring
SDL_CreateThread(threadedMain, NULL);
SDL_ANDROID_MultiThreadedVideoLoop();
}
#endif
};
extern C_LINKAGE void