diff --git a/project/java/Globals.java b/project/java/Globals.java
index 58076a72a..10699e402 100644
--- a/project/java/Globals.java
+++ b/project/java/Globals.java
@@ -60,6 +60,7 @@ class Globals {
public static boolean UseAccelerometerAsArrowKeys = false;
public static boolean UseTouchscreenKeyboard = true;
public static int TouchscreenKeyboardSize = 0;
+ public static int TouchscreenKeyboardDrawSize = 1;
public static int TouchscreenKeyboardTheme = 2;
public static int TouchscreenKeyboardTransparency = 2;
public static int AccelerometerSensitivity = 2;
diff --git a/project/java/Settings.java b/project/java/Settings.java
index e00dc0cb3..07c8dca02 100644
--- a/project/java/Settings.java
+++ b/project/java/Settings.java
@@ -142,6 +142,7 @@ class Settings
for(int i = 0; i < Globals.OptionalDataDownload.length; i++)
out.writeBoolean(Globals.OptionalDataDownload[i]);
out.writeBoolean(Globals.BrokenLibCMessageShown);
+ out.writeInt(Globals.TouchscreenKeyboardDrawSize);
out.close();
settingsLoaded = true;
@@ -277,6 +278,7 @@ class Settings
for(int i = 0; i < Globals.OptionalDataDownload.length; i++)
Globals.OptionalDataDownload[i] = settingsFile.readBoolean();
Globals.BrokenLibCMessageShown = settingsFile.readBoolean();
+ Globals.TouchscreenKeyboardDrawSize = settingsFile.readInt();
settingsLoaded = true;
@@ -604,6 +606,7 @@ class Settings
{
new ScreenKeyboardThemeConfig(),
new ScreenKeyboardSizeConfig(),
+ new ScreenKeyboardDrawSizeConfig(),
new ScreenKeyboardTransparencyConfig(),
new RemapScreenKbConfig(),
new CustomizeScreenKbLayout(),
@@ -994,6 +997,44 @@ class Settings
}
}
+ static class ScreenKeyboardDrawSizeConfig extends Menu
+ {
+ String title(final MainActivity p)
+ {
+ return p.getResources().getString(R.string.controls_screenkb_drawsize);
+ }
+ void run (final MainActivity p)
+ {
+ final CharSequence[] items = { p.getResources().getString(R.string.controls_screenkb_large),
+ p.getResources().getString(R.string.controls_screenkb_medium),
+ p.getResources().getString(R.string.controls_screenkb_small),
+ p.getResources().getString(R.string.controls_screenkb_tiny) };
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(p);
+ builder.setTitle(p.getResources().getString(R.string.controls_screenkb_drawsize));
+ builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardDrawSize, new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int item)
+ {
+ Globals.TouchscreenKeyboardDrawSize = item;
+
+ dialog.dismiss();
+ goBack(p);
+ }
+ });
+ builder.setOnCancelListener(new DialogInterface.OnCancelListener()
+ {
+ public void onCancel(DialogInterface dialog)
+ {
+ goBack(p);
+ }
+ });
+ AlertDialog alert = builder.create();
+ alert.setOwnerActivity(p);
+ alert.show();
+ }
+ }
+
static class ScreenKeyboardThemeConfig extends Menu
{
String title(final MainActivity p)
@@ -2358,6 +2399,7 @@ class Settings
{
nativeSetTouchscreenKeyboardUsed();
nativeSetupScreenKeyboard( Globals.TouchscreenKeyboardSize,
+ Globals.TouchscreenKeyboardDrawSize,
Globals.TouchscreenKeyboardTheme,
Globals.AppTouchscreenKeyboardKeysAmountAutoFire,
Globals.TouchscreenKeyboardTransparency );
@@ -2446,7 +2488,7 @@ class Settings
private static native void nativeSetSmoothVideo();
private static native void nativeSetCompatibilityHacks();
private static native void nativeSetVideoMultithreaded();
- private static native void nativeSetupScreenKeyboard(int size, int theme, int nbuttonsAutoFire, int transparency);
+ private static native void nativeSetupScreenKeyboard(int size, int drawsize, int theme, int nbuttonsAutoFire, int transparency);
private static native void nativeSetupScreenKeyboardButtons(byte[] img);
private static native void nativeInitKeymap();
private static native int nativeGetKeymapKey(int key);
diff --git a/project/java/translations/values-de/strings.xml b/project/java/translations/values-de/strings.xml
index 963f86394..d963f6da5 100644
--- a/project/java/translations/values-de/strings.xml
+++ b/project/java/translations/values-de/strings.xml
@@ -133,4 +133,5 @@
Klein (Telefon)
Uberklein (Xperia Mini)
Weitere Optionen
+Größe der Schaltfläche Bilder
diff --git a/project/java/translations/values-fi/strings.xml b/project/java/translations/values-fi/strings.xml
index 4cfe49a9b..20b979950 100644
--- a/project/java/translations/values-fi/strings.xml
+++ b/project/java/translations/values-fi/strings.xml
@@ -133,4 +133,5 @@
Pieni (puhelin)
Tiny (Xperia Mini)
Näytä enemmän vaihtoehtoja
+Koko painike kuvia
diff --git a/project/java/translations/values-fr/strings.xml b/project/java/translations/values-fr/strings.xml
index 1cb39e354..430f7f5c3 100644
--- a/project/java/translations/values-fr/strings.xml
+++ b/project/java/translations/values-fr/strings.xml
@@ -136,4 +136,5 @@
Petit (téléphone)
Très petit (Xperia Mini)
Afficher plus d\u0026#39;options
+Taille des images de bouton
diff --git a/project/java/translations/values-ru/strings.xml b/project/java/translations/values-ru/strings.xml
index be081ccc4..635eaa182 100644
--- a/project/java/translations/values-ru/strings.xml
+++ b/project/java/translations/values-ru/strings.xml
@@ -128,4 +128,5 @@
Показать больше параметров
Обнаружена бракованная прошивка
Ваше устройство содержит дефективные системные библиотеки, данное приложение скорее всего не будет работать. Пожалуйста, установите обновление, либо установите неофициальную прошивку, либо скопируйте /system/lib/libc.so с другого устройства (только для специалистов!)
+Размер изображения кнопок
diff --git a/project/java/translations/values-uk/strings.xml b/project/java/translations/values-uk/strings.xml
index dd2be1b1f..94827e7ff 100644
--- a/project/java/translations/values-uk/strings.xml
+++ b/project/java/translations/values-uk/strings.xml
@@ -126,4 +126,5 @@
Маленький (телефон)
Крихiтний (Xperia Mini)
Показати більше параметрів
+Розмір зображення кнопок
diff --git a/project/java/translations/values/strings.xml b/project/java/translations/values/strings.xml
index 7ebcbf572..70694532b 100644
--- a/project/java/translations/values/strings.xml
+++ b/project/java/translations/values/strings.xml
@@ -39,6 +39,7 @@
Accelerometer
On-screen keyboard size
+ Size of button images
Large
Medium
Small
diff --git a/project/jni/application/commandergenius/AndroidAppSettings.cfg b/project/jni/application/commandergenius/AndroidAppSettings.cfg
index deb8f2e18..2b825ecc3 100644
--- a/project/jni/application/commandergenius/AndroidAppSettings.cfg
+++ b/project/jni/application/commandergenius/AndroidAppSettings.cfg
@@ -27,8 +27,8 @@ StartupMenuButtonTimeout=3000
HiddenMenuOptions=''
FirstStartMenuOptions=''
MultiABI=n
-AppVersionCode=3509
-AppVersionName="0.3.5.09"
+AppVersionCode=35009
+AppVersionName="0.3.5.0.09"
CompiledLibraries="tremor ogg"
CustomBuildScript=n
AppCflags='-finline-functions -O2 -DTREMOR=1 -DBUILD_TYPE=LINUX32 -DTARGET_LNX=1 -Werror=strict-aliasing -Werror=cast-align -Werror=pointer-arith -Werror=address'
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 45a6773d2..e78459c04 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
@@ -1807,7 +1807,6 @@ 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);
if( keynum == 0 )
key = SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD;
if( keynum == 1 )
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 b671666ae..8a15957bf 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
@@ -53,9 +53,11 @@ static int touchscreenKeyboardTheme = 0;
static int touchscreenKeyboardShown = 1;
static int AutoFireButtonsNum = 0;
static int buttonsize = 1;
+static int buttonDrawSize = 1;
static int transparency = 128;
static SDL_Rect arrows, buttons[MAX_BUTTONS], buttonsAutoFireRect[MAX_BUTTONS_AUTOFIRE];
+static SDL_Rect arrowsDraw, buttonsDraw[MAX_BUTTONS];
static SDLKey buttonKeysyms[MAX_BUTTONS] = {
SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_0)),
SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_1)),
@@ -197,17 +199,17 @@ int SDL_ANDROID_drawTouchscreenKeyboard()
beginDrawingTex();
if( blendFactor == 0 )
- drawCharTex( &arrowImages[0], NULL, &arrows, 255, 255, 255, transparency );
+ drawCharTex( &arrowImages[0], NULL, &arrowsDraw, 255, 255, 255, transparency );
else
{
if( SDL_GetKeyboardState(NULL)[SDL_KEY(LEFT)] )
- drawCharTex( &arrowImages[1], NULL, &arrows, 255, 255, 255, transparency / blendFactor );
+ drawCharTex( &arrowImages[1], NULL, &arrowsDraw, 255, 255, 255, transparency / blendFactor );
if( SDL_GetKeyboardState(NULL)[SDL_KEY(RIGHT)] )
- drawCharTex( &arrowImages[2], NULL, &arrows, 255, 255, 255, transparency / blendFactor );
+ drawCharTex( &arrowImages[2], NULL, &arrowsDraw, 255, 255, 255, transparency / blendFactor );
if( SDL_GetKeyboardState(NULL)[SDL_KEY(UP)] )
- drawCharTex( &arrowImages[3], NULL, &arrows, 255, 255, 255, transparency / blendFactor );
+ drawCharTex( &arrowImages[3], NULL, &arrowsDraw, 255, 255, 255, transparency / blendFactor );
if( SDL_GetKeyboardState(NULL)[SDL_KEY(DOWN)] )
- drawCharTex( &arrowImages[4], NULL, &arrows, 255, 255, 255, transparency / blendFactor );
+ drawCharTex( &arrowImages[4], NULL, &arrowsDraw, 255, 255, 255, transparency / blendFactor );
}
for( i = 0; i < MAX_BUTTONS; i++ )
@@ -234,12 +236,12 @@ int SDL_ANDROID_drawTouchscreenKeyboard()
( ButtonAutoFireX[i*2] > 0 || ButtonAutoFireX[i*2+1] > 0 ) )
{
int pos1src = buttonImages[i*2+1].w / 2 - ButtonAutoFireX[i*2];
- int pos1dst = buttons[i].w * pos1src / buttonImages[i*2+1].w;
+ int pos1dst = buttonsDraw[i].w * pos1src / buttonImages[i*2+1].w;
int pos2src = buttonImages[i*2+1].w - ( buttonImages[i*2+1].w / 2 - ButtonAutoFireX[i*2+1] );
- int pos2dst = buttons[i].w * pos2src / buttonImages[i*2+1].w;
+ int pos2dst = buttonsDraw[i].w * pos2src / buttonImages[i*2+1].w;
SDL_Rect autoFireCrop = { 0, 0, pos1src, buttonImages[i*2+1].h };
- SDL_Rect autoFireDest = buttons[i];
+ SDL_Rect autoFireDest = buttonsDraw[i];
autoFireDest.w = pos1dst;
drawCharTex( &buttonImages[i*2+1],
@@ -247,15 +249,15 @@ int SDL_ANDROID_drawTouchscreenKeyboard()
autoFireCrop.x = pos2src;
autoFireCrop.w = buttonImages[i*2+1].w - pos2src;
- autoFireDest.x = buttons[i].x + pos2dst;
- autoFireDest.w = buttons[i].w - pos2dst;
+ autoFireDest.x = buttonsDraw[i].x + pos2dst;
+ autoFireDest.w = buttonsDraw[i].w - pos2dst;
drawCharTex( &buttonImages[i*2+1],
&autoFireCrop, &autoFireDest, 255, 255, 255, transparency );
autoFireCrop.x = pos1src;
autoFireCrop.w = pos2src - pos1src;
- autoFireDest.x = buttons[i].x + pos1dst;
+ autoFireDest.x = buttonsDraw[i].x + pos1dst;
autoFireDest.w = pos2dst - pos1dst;
drawCharTex( &buttonAutoFireImages[i*2+1],
@@ -265,7 +267,7 @@ int SDL_ANDROID_drawTouchscreenKeyboard()
{
drawCharTex( ( i < AutoFireButtonsNum && ButtonAutoFire[i] ) ? &buttonAutoFireImages[i*2] :
&buttonImages[ SDL_GetKeyboardState(NULL)[buttonKeysyms[i]] ? (i * 2 + 1) : (i * 2) ],
- NULL, &buttons[i], 255, 255, 255, transparency );
+ NULL, &buttonsDraw[i], 255, 255, 255, transparency );
}
}
endDrawingTex();
@@ -552,18 +554,36 @@ int SDL_ANDROID_processTouchscreenKeyboard(int x, int y, int action, int pointer
return processed;
};
+void shrinkButtonRect(SDL_Rect s, SDL_Rect * d)
+{
+ int i;
+
+ if( !buttonDrawSize )
+ {
+ memcpy(d, &s, sizeof(s));
+ return;
+ }
+
+ d->w = s.w * 2 / (buttonDrawSize+2);
+ d->h = s.h * 2 / (buttonDrawSize+2);
+ d->x = s.x + s.w / 2 - d->w / 2;
+ d->y = s.y + s.h / 2 - d->h / 2;
+}
+
JNIEXPORT void JNICALL
-JAVA_EXPORT_NAME(Settings_nativeSetupScreenKeyboard) ( JNIEnv* env, jobject thiz, jint size, jint theme, jint nbuttonsAutoFire, jint _transparency )
+JAVA_EXPORT_NAME(Settings_nativeSetupScreenKeyboard) ( JNIEnv* env, jobject thiz, jint size, jint drawsize, jint theme, jint nbuttonsAutoFire, jint _transparency )
{
int i, ii;
int nbuttons1row, nbuttons2row;
int _nbuttons = MAX_BUTTONS;
+ SDL_Rect * r;
touchscreenKeyboardTheme = theme;
AutoFireButtonsNum = nbuttonsAutoFire;
if( AutoFireButtonsNum > MAX_BUTTONS_AUTOFIRE )
AutoFireButtonsNum = MAX_BUTTONS_AUTOFIRE;
// TODO: works for horizontal screen orientation only!
buttonsize = size;
+ buttonDrawSize = drawsize;
switch(_transparency)
{
case 0: transparency = 16; break;
@@ -616,6 +636,11 @@ JAVA_EXPORT_NAME(Settings_nativeSetupScreenKeyboard) ( JNIEnv* env, jobject thi
buttonsAutoFireRect[i].x = buttons[i].x - buttons[i].w / 2;
buttonsAutoFireRect[i].y = buttons[i].y - buttons[i].h / 2;
}
+ shrinkButtonRect(arrows, &arrowsDraw);
+ for(i = 0; i < MAX_BUTTONS; i++)
+ {
+ shrinkButtonRect(buttons[i], &buttonsDraw[i]);
+ }
};
@@ -711,11 +736,13 @@ int SDL_ANDROID_SetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos)
if( buttonId == SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD )
{
arrows = *pos;
+ shrinkButtonRect(arrows, &arrowsDraw);
}
else
{
int i = buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0;
buttons[i] = *pos;
+ shrinkButtonRect(buttons[i], &buttonsDraw[i]);
if( i < AutoFireButtonsNum )
{
buttonsAutoFireRect[i].w = buttons[i].w * 2;