diff --git a/changeAppSettings.sh b/changeAppSettings.sh index 7497921f3..143342cf9 100755 --- a/changeAppSettings.sh +++ b/changeAppSettings.sh @@ -434,6 +434,22 @@ if [ -n "$var" ] ; then fi fi +if [ -z "$RedefinedKeysScreenKbNames" -o -z "$AUTO" ]; then +if [ -z "$RedefinedKeysScreenKbNames" ]; then + RedefinedKeysScreenKbNames="$RedefinedKeysScreenKb" + CHANGED=1 +fi +echo +echo "Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu" +echo "$RedefinedKeysScreenKbNames" +echo -n ": " +read var +if [ -n "$var" ] ; then + RedefinedKeysScreenKbNames="$var" + CHANGED=1 +fi +fi + if [ -z "$StartupMenuButtonTimeout" -o -z "$AUTO" ]; then echo echo -n "How long to show startup menu button, in msec, 0 to disable startup menu ($StartupMenuButtonTimeout): " @@ -712,6 +728,7 @@ echo RedefinedKeys=\"$RedefinedKeys\" >> AndroidAppSettings.cfg echo AppTouchscreenKeyboardKeysAmount=$AppTouchscreenKeyboardKeysAmount >> AndroidAppSettings.cfg echo AppTouchscreenKeyboardKeysAmountAutoFire=$AppTouchscreenKeyboardKeysAmountAutoFire >> AndroidAppSettings.cfg echo RedefinedKeysScreenKb=\"$RedefinedKeysScreenKb\" >> AndroidAppSettings.cfg +echo RedefinedKeysScreenKbNames=\"$RedefinedKeysScreenKbNames\" >> AndroidAppSettings.cfg echo StartupMenuButtonTimeout=$StartupMenuButtonTimeout >> AndroidAppSettings.cfg echo HiddenMenuOptions=\'$HiddenMenuOptions\' >> AndroidAppSettings.cfg echo FirstStartMenuOptions=\'$FirstStartMenuOptions\' >> AndroidAppSettings.cfg @@ -1038,6 +1055,7 @@ sed -i "s/public static boolean ResetSdlConfigForThisVersion = .*;/public static sed -i "s|public static String DeleteFilesOnUpgrade = .*;|public static String DeleteFilesOnUpgrade = \"$DeleteFilesOnUpgrade\";|" project/src/Globals.java sed -i "s/public static int AppTouchscreenKeyboardKeysAmount = .*;/public static int AppTouchscreenKeyboardKeysAmount = $AppTouchscreenKeyboardKeysAmount;/" project/src/Globals.java sed -i "s/public static int AppTouchscreenKeyboardKeysAmountAutoFire = .*;/public static int AppTouchscreenKeyboardKeysAmountAutoFire = $AppTouchscreenKeyboardKeysAmountAutoFire;/" project/src/Globals.java +sed -i "s@public static String\\[\\] AppTouchscreenKeyboardKeysNames = .*;@public static String[] AppTouchscreenKeyboardKeysNames = \"$RedefinedKeysScreenKbNames\".split(\" \");@" project/src/Globals.java sed -i "s/public static int StartupMenuButtonTimeout = .*;/public static int StartupMenuButtonTimeout = $StartupMenuButtonTimeout;/" project/src/Globals.java sed -i "s/public static int AppMinimumRAM = .*;/public static int AppMinimumRAM = $AppMinimumRAM;/" project/src/Globals.java sed -i "s/public static Settings.Menu HiddenMenuOptions .*;/public static Settings.Menu HiddenMenuOptions [] = { $HiddenMenuOptions1 };/" project/src/Globals.java diff --git a/project/java/Globals.java b/project/java/Globals.java index b059d6528..e53f30913 100644 --- a/project/java/Globals.java +++ b/project/java/Globals.java @@ -61,6 +61,7 @@ class Globals public static String DeleteFilesOnUpgrade = ""; public static int AppTouchscreenKeyboardKeysAmount = 4; public static int AppTouchscreenKeyboardKeysAmountAutoFire = 1; + public static String[] AppTouchscreenKeyboardKeysNames = "Fire Shoot Switch_weapon Jump Run Hide/Seek".split(" "); public static int StartupMenuButtonTimeout = 3000; public static int AppMinimumRAM = 0; public static Settings.Menu HiddenMenuOptions [] = {}; diff --git a/project/java/Settings.java b/project/java/Settings.java index 2e947a8bb..f450ac0bf 100644 --- a/project/java/Settings.java +++ b/project/java/Settings.java @@ -2057,6 +2057,25 @@ class Settings }; buttons = buttons2; } + + for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ ) + { + imgs[i] = new ImageView(p); + imgs[i].setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + imgs[i].setScaleType(ImageView.ScaleType.MATRIX); + bmps[i] = BitmapFactory.decodeResource( p.getResources(), buttons[i] ); + imgs[i].setImageBitmap(bmps[i]); + imgs[i].setAlpha(128); + layout.addView(imgs[i]); + Matrix m = new Matrix(); + RectF src = new RectF(0, 0, bmps[i].getWidth(), bmps[i].getHeight()); + RectF dst = new RectF(Globals.ScreenKbControlsLayout[i][0], Globals.ScreenKbControlsLayout[i][1], + Globals.ScreenKbControlsLayout[i][2], Globals.ScreenKbControlsLayout[i][3]); + m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); + imgs[i].setImageMatrix(m); + } + boundary.bringToFront(); + setupButton(true); } @@ -2080,16 +2099,6 @@ class Settings } } while( ! Globals.ScreenKbControlsShown[currentButton] ); - if( imgs[currentButton] == null ) - { - imgs[currentButton] = new ImageView(p); - imgs[currentButton].setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); - imgs[currentButton].setScaleType(ImageView.ScaleType.MATRIX); - bmps[currentButton] = BitmapFactory.decodeResource( p.getResources(), buttons[currentButton] ); - imgs[currentButton].setImageBitmap(bmps[currentButton]); - layout.addView(imgs[currentButton]); - boundary.bringToFront(); - } if( Globals.ScreenKbControlsLayout[currentButton][0] == Globals.ScreenKbControlsLayout[currentButton][2] || Globals.ScreenKbControlsLayout[currentButton][1] == Globals.ScreenKbControlsLayout[currentButton][3] ) { @@ -2116,6 +2125,10 @@ class Settings src = new RectF(0, 0, boundaryBmp.getWidth(), boundaryBmp.getHeight()); m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); boundary.setImageMatrix(m); + String buttonText = (currentButton == 0 ? "DPAD" : ( currentButton == 1 ? "Text input" : "" )); + if ( currentButton >= 2 && currentButton - 2 < Globals.AppTouchscreenKeyboardKeysNames.length ) + buttonText = Globals.AppTouchscreenKeyboardKeysNames[currentButton - 2]; + p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help) + "\n" + buttonText.replace("_", " ")); } public void onTouchEvent(final MotionEvent ev) diff --git a/project/jni/application/openarena/AndroidAppSettings.cfg b/project/jni/application/openarena/AndroidAppSettings.cfg index 70df6eedd..f9d5a4f09 100644 --- a/project/jni/application/openarena/AndroidAppSettings.cfg +++ b/project/jni/application/openarena/AndroidAppSettings.cfg @@ -36,6 +36,7 @@ RedefinedKeys="SPACE SPACE NO_REMAP NO_REMAP RETURN ESCAPE LCTRL" AppTouchscreenKeyboardKeysAmount=5 AppTouchscreenKeyboardKeysAmountAutoFire=0 RedefinedKeysScreenKb="SLASH BACKSPACE TAB END LCTRL SPACE UNKNOWN UNKNOWN UNKNOWN UNKNOWN" +RedefinedKeysScreenKbNames="Change_weapon Sniper_view Show_scores Jump/centerview Fire Jump" StartupMenuButtonTimeout=3000 HiddenMenuOptions='OptionalDownloadConfig DisplaySizeConfig' FirstStartMenuOptions='' diff --git a/project/jni/application/openarena/engine b/project/jni/application/openarena/engine index 07dfdc11f..cec6cad84 160000 --- a/project/jni/application/openarena/engine +++ b/project/jni/application/openarena/engine @@ -1 +1 @@ -Subproject commit 07dfdc11f1fbc6d193e6ac92b5dbc9780d618c49 +Subproject commit cec6cad84b8e322c06a1ca7b861c86e14a665fae diff --git a/project/jni/application/openarena/vm b/project/jni/application/openarena/vm index 157d48a0c..f7ed2dc3a 160000 --- a/project/jni/application/openarena/vm +++ b/project/jni/application/openarena/vm @@ -1 +1 @@ -Subproject commit 157d48a0c07d66747d05ce514ea245975ace2dc2 +Subproject commit f7ed2dc3ae0c46c15672b100b8537929abeda772 diff --git a/todo.txt b/todo.txt index d4ed8d3f1..a821162d9 100644 --- a/todo.txt +++ b/todo.txt @@ -3,8 +3,6 @@ Requested features (see also bugs.txt) - When downloading data, show cancel dialog when pressing Back. -- Add game action text to keys in the on-screen keyboard layout dialog. - - Redesign on-screen keyboard layout dialog. - Option to reset SDL config to default.