diff --git a/project/java/Globals.java b/project/java/Globals.java
index eb64e478d..1707e4b28 100644
--- a/project/java/Globals.java
+++ b/project/java/Globals.java
@@ -92,6 +92,7 @@ class Globals {
public static int MultitouchGestureSensitivity = 1;
public static int TouchscreenCalibration[] = new int[4];
public static String DataDir = new String("");
+ public static boolean SmoothVideo = false;
}
class LoadLibrary {
diff --git a/project/java/Settings.java b/project/java/Settings.java
index 229e8cb07..97a855fe6 100644
--- a/project/java/Settings.java
+++ b/project/java/Settings.java
@@ -110,6 +110,7 @@ class Settings
out.writeInt(Globals.ScreenKbControlsLayout[i][ii]);
out.writeInt(Globals.LeftClickKey);
out.writeInt(Globals.RightClickKey);
+ out.writeBoolean(Globals.SmoothVideo);
out.close();
settingsLoaded = true;
@@ -234,6 +235,7 @@ class Settings
Globals.ScreenKbControlsLayout[i][ii] = settingsFile.readInt();
Globals.LeftClickKey = settingsFile.readInt();
Globals.RightClickKey = settingsFile.readInt();
+ Globals.SmoothVideo = settingsFile.readBoolean();
settingsLoaded = true;
@@ -318,6 +320,8 @@ class Settings
items.add(p.getResources().getString(R.string.remap_screenkb_button_gestures));
+ items.add(p.getResources().getString(R.string.video));
+
items.add(p.getResources().getString(R.string.ok));
AlertDialog.Builder builder = new AlertDialog.Builder(p);
@@ -385,6 +389,10 @@ class Settings
showScreenGesturesConfig(p);
selected++;
+ if( item == selected )
+ showVideoSettingsConfig(p);
+ selected++;
+
if( item == selected )
{
Save(p);
@@ -667,14 +675,12 @@ class Settings
{
CharSequence[] items = {
p.getResources().getString(R.string.controls_screenkb),
- p.getResources().getString(R.string.controls_accelnav),
- p.getResources().getString(R.string.pointandclick_keepaspectratio)
+ p.getResources().getString(R.string.controls_accelnav)
};
boolean defaults[] = {
Globals.UseTouchscreenKeyboard,
- Globals.UseAccelerometerAsArrowKeys,
- Globals.KeepAspectRatio,
+ Globals.UseAccelerometerAsArrowKeys
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
@@ -687,8 +693,6 @@ class Settings
Globals.UseTouchscreenKeyboard = isChecked;
if( item == 1 )
Globals.UseAccelerometerAsArrowKeys = isChecked;
- if( item == 2 )
- Globals.KeepAspectRatio = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
@@ -964,14 +968,6 @@ class Settings
static void showAdditionalMouseConfig(final MainActivity p)
{
- if( ! Globals.AppUsesMouse )
- {
- Globals.ShowScreenUnderFinger = false;
- Globals.MoveMouseWithJoystick = false;
- Globals.ClickMouseWithDpad = false;
- showMouseConfigMainMenu(p);
- }
-
CharSequence[] items = {
p.getResources().getString(R.string.pointandclick_showcreenunderfinger2),
p.getResources().getString(R.string.pointandclick_joystickmouse),
@@ -1621,10 +1617,67 @@ class Settings
}
}
+ static void showVideoSettingsConfig(final MainActivity p)
+ {
+ CharSequence[] items = {
+ p.getResources().getString(R.string.pointandclick_keepaspectratio),
+ p.getResources().getString(R.string.pointandclick_showcreenunderfinger2),
+ p.getResources().getString(R.string.video_smooth)
+ };
+ boolean defaults[] = {
+ Globals.KeepAspectRatio,
+ Globals.ShowScreenUnderFinger,
+ Globals.SmoothVideo
+ };
+
+ if(Globals.Using_SDL_1_3)
+ {
+ CharSequence[] items2 = {
+ p.getResources().getString(R.string.pointandclick_keepaspectratio),
+ p.getResources().getString(R.string.pointandclick_showcreenunderfinger2)
+ };
+ boolean defaults2[] = {
+ Globals.KeepAspectRatio,
+ Globals.ShowScreenUnderFinger
+ };
+ items = items2;
+ defaults = defaults2;
+ }
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(p);
+ builder.setTitle(p.getResources().getString(R.string.video));
+ builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
+ {
+ public void onClick(DialogInterface dialog, int item, boolean isChecked)
+ {
+ if( item == 0 )
+ Globals.KeepAspectRatio = isChecked;
+ if( item == 1 )
+ Globals.ShowScreenUnderFinger = isChecked;
+ if( item == 2 )
+ Globals.SmoothVideo = isChecked;
+ }
+ });
+ builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int item)
+ {
+ dialog.dismiss();
+ showConfigMainMenu(p);
+ }
+ });
+
+ AlertDialog alert = builder.create();
+ alert.setOwnerActivity(p);
+ alert.show();
+ }
+
// ===============================================================================================
static void Apply(Activity p)
{
+ if(Globals.SmoothVideo)
+ nativeSetSmoothVideo();
if( Globals.PhoneHasTrackball )
nativeSetTrackballUsed();
if( Globals.AppUsesMouse )
@@ -1724,6 +1777,7 @@ class Settings
private static native void nativeSetJoystickUsed();
private static native void nativeSetMultitouchUsed();
private static native void nativeSetTouchscreenKeyboardUsed();
+ private static native void nativeSetSmoothVideo();
private static native void nativeSetupScreenKeyboard(int size, int theme, int nbuttonsAutoFire, int transparency);
private static native void nativeSetupScreenKeyboardButtons(byte[] img);
private static native void nativeInitKeymap();
diff --git a/project/java/translations/values-de/strings.xml b/project/java/translations/values-de/strings.xml
index e02af116e..4c23f1e06 100644
--- a/project/java/translations/values-de/strings.xml
+++ b/project/java/translations/values-de/strings.xml
@@ -109,4 +109,6 @@
Slide-Bildschirm hinzufügen Taste, drücken Sie Menü zum letzten Knopf rückgängig machen
Physikalische Schlüssel
On-Screen-Lupe
+Video-Einstellungen
+Glatte Video
diff --git a/project/java/translations/values-fi/strings.xml b/project/java/translations/values-fi/strings.xml
index df3f7d51b..8b8789174 100644
--- a/project/java/translations/values-fi/strings.xml
+++ b/project/java/translations/values-fi/strings.xml
@@ -109,4 +109,6 @@
Työnnä näytön lisätä painikkeen, paina Menu kumota viimeksi painike
Fyysinen avain
Näytöllä suurennuslasi
+Videon asetukset
+Tasainen video
diff --git a/project/java/translations/values-fr/strings.xml b/project/java/translations/values-fr/strings.xml
index b60b4e2c6..67346364d 100644
--- a/project/java/translations/values-fr/strings.xml
+++ b/project/java/translations/values-fr/strings.xml
@@ -112,4 +112,6 @@
Faites glisser l\u0026#39;écran pour ajouter le bouton, appuyez sur Menu pour annuler le dernier bouton
Physique clés
Sur l\u0026#39;écran loupe
+Paramètres vidéo
+Smooth la vidéo
diff --git a/project/java/translations/values-ru/strings.xml b/project/java/translations/values-ru/strings.xml
index 9679d3ab9..68e41118b 100644
--- a/project/java/translations/values-ru/strings.xml
+++ b/project/java/translations/values-ru/strings.xml
@@ -102,4 +102,6 @@
Провезите по экрану, чтобы добавить кнопку, нажмите клавишу Меню, чтобы отменить последнюю кнопку
Физическая кнопка
Наэкранная лупа
+Настройки видео
+Сгладить видео
diff --git a/project/java/translations/values-uk/strings.xml b/project/java/translations/values-uk/strings.xml
index d817c7fb7..0221bacd7 100644
--- a/project/java/translations/values-uk/strings.xml
+++ b/project/java/translations/values-uk/strings.xml
@@ -102,4 +102,6 @@
Провезiть по екрану, щоб додати кнопку, натисніть клавішу Меню, щоб скасувати останню кнопку
Фізична кнопка
Наекранна лупа
+Налаштування відео
+Згладити відео
diff --git a/project/java/translations/values/strings.xml b/project/java/translations/values/strings.xml
index 3a1eb063a..4038efd6c 100644
--- a/project/java/translations/values/strings.xml
+++ b/project/java/translations/values/strings.xml
@@ -124,4 +124,7 @@
Calibrate touchscreen
Touch all four edges of the screen, press Menu when done
+ Video settings
+ Smooth the video
+
diff --git a/project/jni/application/src b/project/jni/application/src
index 59d41f41e..104f796a6 120000
--- a/project/jni/application/src
+++ b/project/jni/application/src
@@ -1 +1 @@
-fheroes2
\ No newline at end of file
+ballfield
\ No newline at end of file
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 ec33f6fe6..e4d414907 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
@@ -325,6 +325,9 @@ SDL_Surface *ANDROID_SetVideoMode(_THIS, SDL_Surface *current,
SDL_OutOfMemory();
return(NULL);
}
+ if( SDL_ANDROID_SmoothVideo )
+ SDL_SetTextureScaleMode((SDL_Texture *)current->hwdata, SDL_TEXTURESCALEMODE_SLOW);
+
// Register main video texture to be recreated when needed
HwSurfaceCount++;
HwSurfaceList = SDL_realloc( HwSurfaceList, HwSurfaceCount * sizeof(SDL_Surface *) );
@@ -467,6 +470,9 @@ static int ANDROID_AllocHWSurface(_THIS, SDL_Surface *surface)
return(-1);
}
+ if( SDL_ANDROID_SmoothVideo )
+ SDL_SetTextureScaleMode((SDL_Texture *)surface->hwdata, SDL_TEXTURESCALEMODE_SLOW);
+
if( surface->format->Amask )
{
SDL_SetTextureAlphaMod((struct SDL_Texture *)surface->hwdata, SDL_ALPHA_OPAQUE);
@@ -553,6 +559,8 @@ static int ANDROID_LockHWSurface(_THIS, SDL_Surface *surface)
SDL_OutOfMemory();
return(-1);
}
+ if( SDL_ANDROID_SmoothVideo )
+ SDL_SetTextureScaleMode((SDL_Texture *)SDL_CurrentVideoSurface->hwdata, SDL_TEXTURESCALEMODE_SLOW);
// Register main video texture to be recreated when needed
HwSurfaceCount++;
HwSurfaceList = SDL_realloc( HwSurfaceList, HwSurfaceCount * sizeof(SDL_Surface *) );
@@ -937,12 +945,15 @@ void SDL_ANDROID_VideoContextRecreated()
if( HwSurfaceList[i] == SDL_CurrentVideoSurface )
format = SDL_PIXELFORMAT_RGB565;
HwSurfaceList[i]->hwdata = (struct private_hwdata *)SDL_CreateTexture(format, SDL_TEXTUREACCESS_STATIC, HwSurfaceList[i]->w, HwSurfaceList[i]->h);
- if( !HwSurfaceList[i]->hwdata )
+ if( !HwSurfaceList[i]->hwdata )
{
SDL_OutOfMemory();
return;
}
+ if( SDL_ANDROID_SmoothVideo )
+ SDL_SetTextureScaleMode((SDL_Texture *)HwSurfaceList[i]->hwdata, SDL_TEXTURESCALEMODE_SLOW);
ANDROID_UnlockHWSurface(NULL, HwSurfaceList[i]); // Re-fill texture with graphics
}
}
};
+
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 74e4a5ee5..df5fa3f7d 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
@@ -1512,7 +1512,7 @@ JAVA_EXPORT_NAME(Settings_nativeSetScreenKbKeyLayout) (JNIEnv* env, jobject thiz
{
SDL_Rect rect = {x1, y1, x2-x1, y2-y1};
int key = -1;
- __android_log_print(ANDROID_LOG_INFO, "libSDL", "nativeSetScreenKbKeyLayout: %d %d %d %d", (int)rect.x, (int)rect.y, (int)rect.w, (int)rect.h);
+ //__android_log_print(ANDROID_LOG_INFO, "libSDL", "nativeSetScreenKbKeyLayout: %d %d %d %d", (int)rect.x, (int)rect.y, (int)rect.w, (int)rect.h);
if( keynum == 0 )
key = SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD;
if( keynum == 1 )
diff --git a/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.c b/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.c
index 2f4ac8aec..4653e0438 100644
--- a/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.c
+++ b/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.c
@@ -63,6 +63,7 @@ static jmethodID JavaSwapBuffers = NULL;
static jmethodID JavaShowScreenKeyboard = NULL;
static int glContextLost = 0;
static int showScreenKeyboardDeferred = 0;
+int SDL_ANDROID_SmoothVideo = 0;
static void appPutToBackgroundCallbackDefault(void)
{
@@ -228,7 +229,6 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInitJavaCallbacks) ( JNIEnv* env, jobject t
JavaShowScreenKeyboard = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "showScreenKeyboard", "()V");
ANDROID_InitOSKeymap();
-
}
int SDL_ANDROID_SetApplicationPutToBackgroundCallback(
@@ -244,3 +244,9 @@ int SDL_ANDROID_SetApplicationPutToBackgroundCallback(
if( appRestoredCallback )
appRestoredCallback = appRestored;
}
+
+JNIEXPORT void JNICALL
+JAVA_EXPORT_NAME(Settings_nativeSetSmoothVideo) (JNIEnv* env, jobject thiz)
+{
+ SDL_ANDROID_SmoothVideo = 1;
+}
diff --git a/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.h b/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.h
index 9cc9ec37d..8a411b13c 100644
--- a/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.h
+++ b/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.h
@@ -38,6 +38,7 @@ extern int SDL_ANDROID_TouchscreenCalibrationWidth;
extern int SDL_ANDROID_TouchscreenCalibrationHeight;
extern int SDL_ANDROID_TouchscreenCalibrationX;
extern int SDL_ANDROID_TouchscreenCalibrationY;
+extern int SDL_ANDROID_SmoothVideo;
extern SDL_Surface *SDL_CurrentVideoSurface;
extern SDL_Rect SDL_ANDROID_ForceClearScreenRect;
extern int SDL_ANDROID_ShowScreenUnderFinger;
diff --git a/project/jni/sdl-1.3/src/video/android/SDL_touchscreenkeyboard.c b/project/jni/sdl-1.3/src/video/android/SDL_touchscreenkeyboard.c
index 11f904e40..afc810fe1 100644
--- a/project/jni/sdl-1.3/src/video/android/SDL_touchscreenkeyboard.c
+++ b/project/jni/sdl-1.3/src/video/android/SDL_touchscreenkeyboard.c
@@ -165,13 +165,6 @@ static inline void beginDrawingTex()
static inline void endDrawingTex()
{
- /*
- GLfloat texColor[4] = {0.0f, 0.0f, 0.0f, 0.0f};
- glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, texColor);
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glDisable(GL_BLEND);
- */
-
glDisable(GL_TEXTURE_2D);
}
@@ -196,8 +189,16 @@ static inline void drawCharTex(GLTexture_t * tex, SDL_Rect * src, SDL_Rect * des
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ if( SDL_ANDROID_SmoothVideo )
+ {
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ }
+ else
+ {
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ }
/*
texColor[0] = r * onediv255;
@@ -810,10 +811,7 @@ static int setupScreenKeyboardButton( int buttonID, Uint8 * charBuf )
glGenTextures(1, &data->id);
glBindTexture(GL_TEXTURE_2D, data->id);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture_w, texture_h, 0, GL_RGBA,
format ? GL_UNSIGNED_SHORT_4_4_4_4 : GL_UNSIGNED_SHORT_5_5_5_1, NULL);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
@@ -822,6 +820,9 @@ static int setupScreenKeyboardButton( int buttonID, Uint8 * charBuf )
format ? GL_UNSIGNED_SHORT_4_4_4_4 : GL_UNSIGNED_SHORT_5_5_5_1,
charBuf + 3*sizeof(int) );
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
glDisable(GL_TEXTURE_2D);
return 3*sizeof(int) + w * h * 2;