diff --git a/project/java/Globals.java b/project/java/Globals.java index d9ecccc80..373621782 100644 --- a/project/java/Globals.java +++ b/project/java/Globals.java @@ -105,7 +105,7 @@ class Globals public static int RemapHwKeycode[] = new int[SDL_Keys.JAVA_KEYCODE_LAST]; public static int RemapScreenKbKeycode[] = new int[6]; public static boolean ScreenKbControlsShown[] = new boolean[8]; /* Also joystick and text input button added */ - public static int ScreenKbControlsLayout[][] = new int[][] { { 712, 392, 800, 480 }, { 624, 392, 712, 480 }, { 712, 304, 800, 392 }, { 624, 304, 712, 392 }, { 712, 216, 800, 304 }, { 624, 216, 712, 304 }, { 0, 0, 48, 48 }, { 0, 303, 177, 480 } }; // Values for 800x480 resolution + public static int ScreenKbControlsLayout[][] = new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 712, 392, 800, 480 }, { 624, 392, 712, 480 }, { 712, 304, 800, 392 }, { 624, 304, 712, 392 }, { 712, 216, 800, 304 }, { 624, 216, 712, 304 } }; // Values for 800x480 resolution public static int RemapMultitouchGestureKeycode[] = new int[4]; public static boolean MultitouchGesturesUsed[] = new boolean[4]; public static int MultitouchGestureSensitivity = 1; diff --git a/project/java/Settings.java b/project/java/Settings.java index 31fbf6124..8e8d0e951 100644 --- a/project/java/Settings.java +++ b/project/java/Settings.java @@ -2066,7 +2066,7 @@ class Settings currentButton = -1; if( Globals.TouchscreenKeyboardTheme == 2 ) { - int buttons2[] = { + buttons = new int[] { R.drawable.sun_dpad, R.drawable.sun_keyboard, R.drawable.sun_b1, @@ -2076,15 +2076,50 @@ class Settings R.drawable.sun_b5, R.drawable.sun_b6 }; - buttons = buttons2; } + int displayX = 800; + int displayY = 480; + try { + DisplayMetrics dm = new DisplayMetrics(); + p.getWindowManager().getDefaultDisplay().getMetrics(dm); + displayX = dm.widthPixels; + displayY = dm.heightPixels; + } catch (Exception eeeee) {} + for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ ) { if( ! Globals.ScreenKbControlsShown[i] ) continue; if( currentButton == -1 ) currentButton = i; + + // Check if the button is off screen edge or shrunk to zero + if( Globals.ScreenKbControlsLayout[i][0] > Globals.ScreenKbControlsLayout[i][2] - displayX/15 ) + Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayX/15; + if( Globals.ScreenKbControlsLayout[i][1] > Globals.ScreenKbControlsLayout[i][3] - displayY/15 ) + Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][3] - displayY/15; + if( Globals.ScreenKbControlsLayout[i][0] < 0 ) + { + Globals.ScreenKbControlsLayout[i][2] = -Globals.ScreenKbControlsLayout[i][0]; + Globals.ScreenKbControlsLayout[i][0] = 0; + } + if( Globals.ScreenKbControlsLayout[i][2] > displayX ) + { + Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayX; + Globals.ScreenKbControlsLayout[i][2] = displayX; + } + if( Globals.ScreenKbControlsLayout[i][1] < 0 ) + { + Globals.ScreenKbControlsLayout[i][3] = -Globals.ScreenKbControlsLayout[i][0]; + Globals.ScreenKbControlsLayout[i][1] = 0; + } + if( Globals.ScreenKbControlsLayout[i][3] > displayY ) + { + Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][2] - displayY; + Globals.ScreenKbControlsLayout[i][3] = displayY; + } + 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); @@ -2636,14 +2671,14 @@ class Settings Globals.AppTouchscreenKeyboardKeysAmountAutoFire, Globals.TouchscreenKeyboardTransparency ); SetupTouchscreenKeyboardGraphics(p); - for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ ) - nativeSetScreenKbKeyUsed(i, Globals.ScreenKbControlsShown[i] ? 1 : 0); for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ ) nativeSetKeymapKeyScreenKb(i, SDL_Keys.values[Globals.RemapScreenKbKeycode[i]]); for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ ) if( Globals.ScreenKbControlsLayout[i][0] < Globals.ScreenKbControlsLayout[i][2] ) nativeSetScreenKbKeyLayout( i, Globals.ScreenKbControlsLayout[i][0], Globals.ScreenKbControlsLayout[i][1], Globals.ScreenKbControlsLayout[i][2], Globals.ScreenKbControlsLayout[i][3]); + for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ ) + nativeSetScreenKbKeyUsed(i, Globals.ScreenKbControlsShown[i] ? 1 : 0); } else Globals.UseTouchscreenKeyboard = false; diff --git a/project/jni/application/ballfield/AndroidAppSettings.cfg b/project/jni/application/ballfield/AndroidAppSettings.cfg index e6a9d87b8..08466b91f 100644 --- a/project/jni/application/ballfield/AndroidAppSettings.cfg +++ b/project/jni/application/ballfield/AndroidAppSettings.cfg @@ -34,7 +34,7 @@ AppUsesMultitouch=y AppRecordsAudio=n NonBlockingSwapBuffers=n RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE" -AppTouchscreenKeyboardKeysAmount=6 +AppTouchscreenKeyboardKeysAmount=1 AppTouchscreenKeyboardKeysAmountAutoFire=0 RedefinedKeysScreenKb="0 1 2 3 4 5 6 7 8 9" RedefinedKeysScreenKbNames="0 1 2 3 4 5 6 7 8 9" diff --git a/project/jni/application/openarena/engine b/project/jni/application/openarena/engine index 00e839b40..1c3f8aa9c 160000 --- a/project/jni/application/openarena/engine +++ b/project/jni/application/openarena/engine @@ -1 +1 @@ -Subproject commit 00e839b4082aa1682434d70a6e5bd44c39d262c9 +Subproject commit 1c3f8aa9c102c1a1c70e18b2bcb0a955decc2033 diff --git a/project/jni/application/openarena/vm b/project/jni/application/openarena/vm index 2fa31601b..c88124ddc 160000 --- a/project/jni/application/openarena/vm +++ b/project/jni/application/openarena/vm @@ -1 +1 @@ -Subproject commit 2fa31601b2ae97b92daac0d43060fdf560c90345 +Subproject commit c88124ddcb2f6b7857ac72497d30a30459d3545e