diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c index 952ff673c..3ca618232 100644 --- a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c +++ b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c @@ -101,6 +101,8 @@ struct SDL_PrivateVideoData { // Pointer to in-memory video surface static int memX = 0; static int memY = 0; +int SDL_ANDROID_sFakeWindowWidth = 640; +int SDL_ANDROID_sFakeWindowHeight = 480; // In-memory surfaces static void * memBuffer1 = NULL; static void * memBuffer2 = NULL; @@ -235,6 +237,8 @@ SDL_Surface *ANDROID_SetVideoMode(_THIS, SDL_Surface *current, memX = width; memY = height; + SDL_ANDROID_sFakeWindowWidth = width; + SDL_ANDROID_sFakeWindowHeight = height; if( ! sdl_opengl ) { @@ -355,7 +359,11 @@ static int ANDROID_FlipHWSurface(_THIS, SDL_Surface *surface) if( ! sdl_opengl ) { glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, memX, memY, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, memBuffer); +#if SDL_VIDEO_RENDER_RESIZE glDrawTexiOES(0, 0, 1, SDL_ANDROID_sWindowWidth, SDL_ANDROID_sWindowHeight); // Stretch to screen +#else + glDrawTexiOES(0, SDL_ANDROID_sWindowHeight - SDL_ANDROID_sFakeWindowHeight, 1, SDL_ANDROID_sFakeWindowWidth, SDL_ANDROID_sFakeWindowHeight); // Do not stretch +#endif if( surface->flags & SDL_DOUBLEBUF ) { diff --git a/alienblaster/project/sdl/sdl-1.3/src/audio/android/SDL_androidaudio.c b/alienblaster/project/sdl/sdl-1.3/src/audio/android/SDL_androidaudio.c index 89ce22aea..82f439dc2 100644 --- a/alienblaster/project/sdl/sdl-1.3/src/audio/android/SDL_androidaudio.c +++ b/alienblaster/project/sdl/sdl-1.3/src/audio/android/SDL_androidaudio.c @@ -198,6 +198,7 @@ static int ANDROIDAUD_OpenAudio (_THIS, SDL_AudioSpec *spec) audioFormat->samples = audioBufferSize / bytesPerSample / audioFormat->channels; audioFormat->size = audioBufferSize; + __android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_OpenAudio(): app opened audio bytespersample %d freq %d channels %d bufsize %d", bytesPerSample, audioFormat->freq, (jint)audioFormat->channels, audioBufferSize); SDL_CalculateAudioSpec(&this->spec); diff --git a/alienblaster/project/sdl/sdl-1.3/src/video/android/SDL_androidinput.c b/alienblaster/project/sdl/sdl-1.3/src/video/android/SDL_androidinput.c index 94fd447eb..6272cb938 100644 --- a/alienblaster/project/sdl/sdl-1.3/src/video/android/SDL_androidinput.c +++ b/alienblaster/project/sdl/sdl-1.3/src/video/android/SDL_androidinput.c @@ -69,6 +69,23 @@ enum MOUSE_ACTION { MOUSE_DOWN = 0, MOUSE_UP=1, MOUSE_MOVE=2 }; JNIEXPORT void JNICALL JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, jint x, jint y, jint action ) { +#if SDL_VIDEO_RENDER_RESIZE + // Translate mouse coordinates + +#if SDL_VERSION_ATLEAST(1,3,0) + SDL_Renderer *renderer; + renderer = SDL_GetCurrentRenderer(SDL_TRUE); + if( renderer && renderer->window ) { + x = x * renderer->window->w / renderer->window->display->desktop_mode.w; + y = y * renderer->window->h / renderer->window->display->desktop_mode.h; + } +#else + x = x * SDL_ANDROID_sFakeWindowWidth / SDL_ANDROID_sWindowWidth; + y = y * SDL_ANDROID_sFakeWindowHeight / SDL_ANDROID_sWindowHeight; +#endif + +#endif + if( action == MOUSE_DOWN || action == MOUSE_UP ) { #if SDL_VERSION_ATLEAST(1,3,0) diff --git a/alienblaster/project/sdl/sdl-1.3/src/video/android/SDL_androidvideo.c b/alienblaster/project/sdl/sdl-1.3/src/video/android/SDL_androidvideo.c index 92ddf83bb..6888a849c 100644 --- a/alienblaster/project/sdl/sdl-1.3/src/video/android/SDL_androidvideo.c +++ b/alienblaster/project/sdl/sdl-1.3/src/video/android/SDL_androidvideo.c @@ -45,7 +45,7 @@ // The device screen dimensions to draw on -int SDL_ANDROID_sWindowWidth = 320; +int SDL_ANDROID_sWindowWidth = 640; int SDL_ANDROID_sWindowHeight = 480; // Extremely wicked JNI environment to call Java functions from C code diff --git a/alienblaster/project/sdl/sdl-1.3/src/video/android/SDL_androidvideo.h b/alienblaster/project/sdl/sdl-1.3/src/video/android/SDL_androidvideo.h index ab7f7e87f..7221daaed 100644 --- a/alienblaster/project/sdl/sdl-1.3/src/video/android/SDL_androidvideo.h +++ b/alienblaster/project/sdl/sdl-1.3/src/video/android/SDL_androidvideo.h @@ -30,6 +30,8 @@ extern void ANDROID_InitOSKeymap(); extern int SDL_ANDROID_sWindowWidth; extern int SDL_ANDROID_sWindowHeight; +extern int SDL_ANDROID_sFakeWindowWidth; // SDL 1.2 only +extern int SDL_ANDROID_sFakeWindowHeight; // SDL 1.2 only extern int SDL_ANDROID_CallJavaSwapBuffers();