diff --git a/project/jni/application/fheroes2/AndroidAppSettings.cfg b/project/jni/application/fheroes2/AndroidAppSettings.cfg index 5c6bbdfa5..6a05ab1e7 100644 --- a/project/jni/application/fheroes2/AndroidAppSettings.cfg +++ b/project/jni/application/fheroes2/AndroidAppSettings.cfg @@ -25,9 +25,9 @@ AppVersionCode=208302 AppVersionName="2083.02" CompiledLibraries="sdl_net sdl_mixer sdl_image sdl_ttf png intl" CustomBuildScript=n -AppCflags='-finline-functions -O2 -DWITH_ZLIB -DWITH_MIXER -DWITH_XML -DWITH_IMAGE -DWITH_TTF' +AppCflags='-finline-functions -O2 -DWITH_ZLIB -DWITH_MIXER -DWITH_XML -DWITH_IMAGE -DWITH_TTF -DBUILD_RELEASE' AppLdflags='' AppSubdirsBuild='fheroes2/src/engine/* fheroes2/src/fheroes2/* fheroes2/src/xmlccwrap/* fheroes2-ai' AppUseCrystaXToolchain=n -AppCmdline='fheroes2 -d' +AppCmdline='fheroes2' ReadmeText='^You may press "Home" now - the data will be downloaded in background' diff --git a/project/jni/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c b/project/jni/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c index ad994182b..3faacd059 100644 --- a/project/jni/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c +++ b/project/jni/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c @@ -847,9 +847,36 @@ static int ANDROID_FlipHWSurface(_THIS, SDL_Surface *surface) rect.h = SDL_CurrentVideoSurface->h; SDL_UpdateTexture((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &rect, SDL_CurrentVideoSurface->pixels, SDL_CurrentVideoSurface->pitch); SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &rect, &rect); - if( SDL_ANDROID_ShowScreenUnderFinger ) + if( SDL_ANDROID_ShowScreenUnderFinger && SDL_ANDROID_ShowScreenUnderFingerRect.w > 0 ) { SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &SDL_ANDROID_ShowScreenUnderFingerRectSrc, &SDL_ANDROID_ShowScreenUnderFingerRect); + SDL_Rect frame = SDL_ANDROID_ShowScreenUnderFingerRect; + // For some reason this code fails - it just outputs nothing to screen + /* + SDL_SetRenderDrawColor(0, 0, 0, SDL_ALPHA_OPAQUE); + SDL_RenderFillRect(&SDL_ANDROID_ShowScreenUnderFingerRect); + SDL_SetRenderDrawColor(255, 255, 255, SDL_ALPHA_OPAQUE); + SDL_RenderDrawRect(&SDL_ANDROID_ShowScreenUnderFingerRectSrc); + SDL_SetRenderDrawColor(0, 0, 0, SDL_ALPHA_OPAQUE); + SDL_RenderDrawRect(&frame); + */ + // Do it old-fashioned way with direct GL calls + glPushMatrix(); + glLoadIdentity(); + glOrthox( 0, SDL_ANDROID_sFakeWindowWidth * 0x10000, SDL_ANDROID_sFakeWindowHeight * 0x10000, 0, 0, 1 * 0x10000 ); + glColor4x(0, 0, 0, 0x10000); + glEnableClientState(GL_VERTEX_ARRAY); + glColor4x(0, 0, 0, 0x10000); + GLshort vertices[] = { frame.x, frame.y, + frame.x + frame.w, frame.y, + frame.x + frame.w, frame.y + frame.h, + frame.x, frame.y + frame.h }; + glVertexPointer(2, GL_SHORT, 0, vertices); + glDrawArrays(GL_LINE_LOOP, 0, 4); + glDisableClientState(GL_VERTEX_ARRAY); + glPopMatrix(); + glFlush(); + } } diff --git a/project/jni/sdl-1.3/src/video/android/SDL_androidinput.c b/project/jni/sdl-1.3/src/video/android/SDL_androidinput.c index 7f26346d5..8af883330 100644 --- a/project/jni/sdl-1.3/src/video/android/SDL_androidinput.c +++ b/project/jni/sdl-1.3/src/video/android/SDL_androidinput.c @@ -77,20 +77,23 @@ static inline int InsideRect(const SDL_Rect * r, int x, int y) void UpdateScreenUnderFingerRect(int x, int y) { +#if SDL_VERSION_ATLEAST(1,3,0) + return; + /* int screenX = 320, screenY = 240; if( !SDL_ANDROID_ShowScreenUnderFinger ) return; -#if SDL_VERSION_ATLEAST(1,3,0) SDL_Window * window = SDL_GetFocusWindow(); if( window && window->renderer->window ) { screenX = window->w; screenY = window->h; } + */ #else - screenX = SDL_ANDROID_sFakeWindowWidth; - screenY = SDL_ANDROID_sFakeWindowHeight; -#endif + int screenX = SDL_ANDROID_sFakeWindowWidth, screenY = SDL_ANDROID_sFakeWindowHeight; + if( !SDL_ANDROID_ShowScreenUnderFinger ) + return; SDL_ANDROID_ShowScreenUnderFingerRectSrc.w = screenX / 4; SDL_ANDROID_ShowScreenUnderFingerRectSrc.h = screenY / 4; @@ -113,12 +116,13 @@ void UpdateScreenUnderFingerRect(int x, int y) SDL_ANDROID_ShowScreenUnderFingerRect.x = 0; if( SDL_ANDROID_ShowScreenUnderFingerRect.y < 0 ) SDL_ANDROID_ShowScreenUnderFingerRect.y = 0; - if( SDL_ANDROID_ShowScreenUnderFingerRect.x + SDL_ANDROID_ShowScreenUnderFingerRect.w > screenX ) - SDL_ANDROID_ShowScreenUnderFingerRect.x = screenX - SDL_ANDROID_ShowScreenUnderFingerRect.w; - if( SDL_ANDROID_ShowScreenUnderFingerRect.y + SDL_ANDROID_ShowScreenUnderFingerRect.h > screenY ) - SDL_ANDROID_ShowScreenUnderFingerRect.y = screenY - SDL_ANDROID_ShowScreenUnderFingerRect.h; + if( SDL_ANDROID_ShowScreenUnderFingerRect.x + SDL_ANDROID_ShowScreenUnderFingerRect.w >= screenX ) + SDL_ANDROID_ShowScreenUnderFingerRect.x = screenX - SDL_ANDROID_ShowScreenUnderFingerRect.w - 1; + if( SDL_ANDROID_ShowScreenUnderFingerRect.y + SDL_ANDROID_ShowScreenUnderFingerRect.h >= screenY ) + SDL_ANDROID_ShowScreenUnderFingerRect.y = screenY - SDL_ANDROID_ShowScreenUnderFingerRect.h - 1; if( InsideRect(&SDL_ANDROID_ShowScreenUnderFingerRect, x, y) ) - SDL_ANDROID_ShowScreenUnderFingerRect.x = x - SDL_ANDROID_ShowScreenUnderFingerRect.w*11/10; + SDL_ANDROID_ShowScreenUnderFingerRect.x = x - SDL_ANDROID_ShowScreenUnderFingerRect.w*11/10 - 1; +#endif }