Fixed SDL 1.2 compilation, force screen update when "Show screen under finger" selected and user releases finger

This commit is contained in:
pelya
2010-11-15 17:58:48 +02:00
parent 9954bc4a89
commit 988fa75f57
7 changed files with 16 additions and 14 deletions

View File

@@ -5,7 +5,7 @@ AppName="Free Heroes 2"
AppFullName=net.sourceforge.fheroes2
ScreenOrientation=h
InhibitSuspend=n
AppDataDownloadUrl="Game data|data.zip^MIDI music support|http://sourceforge.net/projects/libsdl-android/files/timidity.zip/download"
AppDataDownloadUrl="Game data|data.zip^MIDI music support (18 Mb)|http://sourceforge.net/projects/libsdl-android/files/timidity.zip/download"
SdlVideoResize=y
SdlVideoResizeKeepAspect=n
NeedDepthBuffer=n

View File

@@ -202,7 +202,7 @@ int ANDROID_VideoInit(_THIS, SDL_PixelFormat *vformat)
}
int bpp;
SDL_zero(alphaFormat);
SDL_memset(&alphaFormat, 0, sizeof(alphaFormat));
SDL_PixelFormatEnumToMasks( SDL_PIXELFORMAT_RGBA4444, &bpp,
&alphaFormat.Rmask, &alphaFormat.Gmask,
&alphaFormat.Bmask, &alphaFormat.Amask );
@@ -279,7 +279,7 @@ SDL_Surface *ANDROID_SetVideoMode(_THIS, SDL_Surface *current,
SDL_SelectVideoDisplay(0);
SDL_VideoWindow = SDL_CreateWindow("", 0, 0, width, height, SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS | SDL_WINDOW_OPENGL);
SDL_zero(mode);
SDL_memset(&mode, 0, sizeof(mode));
mode.format = SDL_PIXELFORMAT_RGB565;
SDL_SetWindowDisplayMode(SDL_VideoWindow, &mode);
@@ -316,7 +316,7 @@ SDL_Surface *ANDROID_SetVideoMode(_THIS, SDL_Surface *current,
}
/* Allocate the new pixel format for the screen */
SDL_zero(format);
SDL_memset(&format, 0, sizeof(format));
SDL_PixelFormatEnumToMasks( SDL_PIXELFORMAT_RGB565, &bpp1,
&format.Rmask, &format.Gmask,
&format.Bmask, &format.Amask );
@@ -392,7 +392,7 @@ static int ANDROID_AllocHWSurface(_THIS, SDL_Surface *surface)
int bpp;
format = SDL_PIXELFORMAT_RGBA4444;
DEBUGOUT("ANDROID_AllocHWSurface() SDL_PIXELFORMAT_RGBA4444");
SDL_zero(format1);
SDL_memset(&format1, 0, sizeof(format1));
SDL_PixelFormatEnumToMasks( format, &bpp,
&format1.Rmask, &format1.Gmask,
&format1.Bmask, &format1.Amask );
@@ -566,7 +566,7 @@ static void ANDROID_UnlockHWSurface(_THIS, SDL_Surface *surface)
hwformat = SDL_PIXELFORMAT_RGB565;
/* Allocate the new pixel format for the screen */
SDL_zero(format);
SDL_memset(&format, 0, sizeof(format));
SDL_PixelFormatEnumToMasks( hwformat, &bpp,
&format.Rmask, &format.Gmask,
&format.Bmask, &format.Amask );

View File

@@ -91,7 +91,7 @@ int ANDROID_VideoInit(_THIS)
mode.format = SDL_PIXELFORMAT_RGB565;
mode.driverdata = NULL;
SDL_zero(display);
SDL_memset(&display, 0, sizeof(display));
display.desktop_mode = mode;
display.current_mode = mode;
display.driverdata = NULL;

View File

@@ -447,7 +447,7 @@ SDL_InitFormat(SDL_PixelFormat * format, int bpp, Uint32 Rmask, Uint32 Gmask,
Uint32 mask;
/* Set up the format */
SDL_zerop(format);
SDL_memset(format, 0, sizeof(*format));
format->BitsPerPixel = bpp;
format->BytesPerPixel = (bpp + 7) / 8;
if (Rmask || Bmask || Gmask) { /* Packed pixels with custom mask */

View File

@@ -343,7 +343,7 @@ SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode)
{
SDL_VideoDisplay display;
SDL_zero(display);
SDL_memset(&display, 0, sizeof(display));
if (desktop_mode) {
display.desktop_mode = *desktop_mode;
}
@@ -756,7 +756,7 @@ SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode)
if (mode) {
window->fullscreen_mode = *mode;
} else {
SDL_zero(window->fullscreen_mode);
SDL_memset(&(window->fullscreen_mode), 0, sizeof(window->fullscreen_mode));
}
return 0;
}

View File

@@ -175,11 +175,11 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, j
if( pointerId == 0 )
{
#if SDL_VERSION_ATLEAST(1,3,0)
SDL_SendMouseMotion(NULL, 0, x, y);
#else
SDL_PrivateMouseMotion(0, 0, x, y);
#define SDL_SendMouseMotion(A,B,X,Y) SDL_PrivateMouseMotion(0, 0, X, Y)
#define SDL_SendMouseButton(N, A, B) SDL_PrivateMouseButton( A, B, 0, 0 )
#endif
SDL_SendMouseMotion(NULL, 0, x, y);
if( action == MOUSE_UP )
{
if( SDL_GetMouseState( NULL, NULL ) & SDL_BUTTON(SDL_BUTTON_LEFT) )
@@ -188,6 +188,8 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, j
SDL_SendMouseButton( NULL, SDL_RELEASED, SDL_BUTTON_RIGHT );
SDL_ANDROID_ShowScreenUnderFingerRect.w = SDL_ANDROID_ShowScreenUnderFingerRect.h = 0;
SDL_ANDROID_ShowScreenUnderFingerRectSrc.w = SDL_ANDROID_ShowScreenUnderFingerRectSrc.h = 0;
if( SDL_ANDROID_ShowScreenUnderFinger )
SDL_SendMouseMotion(NULL, 0, x > 0 ? x-1 : 0, y); // Move mouse by 1 pixel so it will force screen update and mouse-under-finger window will be removed
}
if( action == MOUSE_DOWN )
{

View File

@@ -136,8 +136,8 @@ will most probably fail because of ranlib - just edit Android.mk to compile lib
MIDI support can be emulated via SDL_mixer lib (it uses Timidity internally)- download file
http://www.libsdl.org/projects/mixer/timidity/timidity.tar.gz
unpack it and put "timidity" dir into your game data zipfile.
Or you may specify this URL directly as an optional download for ChangeAppSettings.sh:
http://sourceforge.net/projects/libsdl-android/files/timidity.zip/download
Or you may paste this URL directly as an optional download in ChangeAppSettings.sh:
MIDI music support (18 Mb)|http://sourceforge.net/projects/libsdl-android/files/timidity.zip/download
The ARM architecture has some limitations which you have to be aware about -
if you'll access integer that's not 4-byte aligned you'll get garbage instead of correct value,