SDL: increased on-screen keyboard to 12 keys
This commit is contained in:
@@ -132,12 +132,66 @@ class Globals
|
||||
public static boolean KeepAspectRatio = KeepAspectRatioDefaultSetting;
|
||||
public static boolean TvBorders = true;
|
||||
public static int RemapHwKeycode[] = new int[SDL_Keys.JAVA_KEYCODE_LAST];
|
||||
public static int RemapScreenKbKeycode[] = new int[6];
|
||||
public static int ScreenKbControlsLayout[][] = AppUsesThirdJoystick ? // Values for 800x480 resolution
|
||||
new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 400, 392, 488, 480 }, { 312, 392, 400, 480 }, { 400, 304, 488, 392 }, { 312, 304, 400, 392 }, { 400, 216, 488, 304 }, { 312, 216, 400, 304 }, { 623, 303, 800, 480 }, { 623, 126, 800, 303 } } :
|
||||
AppUsesSecondJoystick ?
|
||||
new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 400, 392, 488, 480 }, { 312, 392, 400, 480 }, { 400, 304, 488, 392 }, { 312, 304, 400, 392 }, { 400, 216, 488, 304 }, { 312, 216, 400, 304 }, { 623, 303, 800, 480 } } :
|
||||
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 } };
|
||||
public static int RemapScreenKbKeycode[] = new int[12];
|
||||
// Values for 800x480 resolution
|
||||
public static int ScreenKbControlsLayout[][] =
|
||||
AppUsesThirdJoystick ? new int[][]
|
||||
{
|
||||
{ 0, 303, 177, 480 }, // Main joystick/DPAD
|
||||
{ 0, 0, 48, 48 }, // Text input button
|
||||
{ 400, 392, 488, 480 }, // Button 0
|
||||
{ 312, 392, 400, 480 }, // Button 1
|
||||
{ 400, 304, 488, 392 }, // Button 2
|
||||
{ 312, 304, 400, 392 }, // Button 3
|
||||
{ 400, 216, 488, 304 }, // Button 4
|
||||
{ 312, 216, 400, 304 }, // Button 5
|
||||
{ 623, 303, 800, 480 }, // Joystick 2
|
||||
{ 623, 126, 800, 303 }, // Joystick 3
|
||||
{ 400, 392, 488, 480 }, // Button 6 - copy of button 0, to be redefined in the code
|
||||
{ 312, 392, 400, 480 }, // Button 7 - copy of button 1, to be redefined in the code
|
||||
{ 400, 304, 488, 392 }, // Button 8 - copy of button 2, to be redefined in the code
|
||||
{ 312, 304, 400, 392 }, // Button 9 - copy of button 3, to be redefined in the code
|
||||
{ 400, 216, 488, 304 }, // Button 10 - copy of button 4, to be redefined in the code
|
||||
{ 312, 216, 400, 304 }, // Button 11 - copy of button 5, to be redefined in the code
|
||||
}
|
||||
: AppUsesSecondJoystick ? new int[][]
|
||||
{
|
||||
{ 0, 303, 177, 480 }, // Main joystick/DPAD
|
||||
{ 0, 0, 48, 48 }, // Text input button
|
||||
{ 400, 392, 488, 480 }, // Button 0
|
||||
{ 312, 392, 400, 480 }, // Button 1
|
||||
{ 400, 304, 488, 392 }, // Button 2
|
||||
{ 312, 304, 400, 392 }, // Button 3
|
||||
{ 400, 216, 488, 304 }, // Button 4
|
||||
{ 312, 216, 400, 304 }, // Button 5
|
||||
{ 623, 303, 800, 480 }, // Joystick 2
|
||||
{ 0, 0, 0, 0, }, // Joystick 3
|
||||
{ 400, 392, 488, 480 }, // Button 6 - copy of button 0, to be redefined in the code
|
||||
{ 312, 392, 400, 480 }, // Button 7 - copy of button 1, to be redefined in the code
|
||||
{ 400, 304, 488, 392 }, // Button 8 - copy of button 2, to be redefined in the code
|
||||
{ 312, 304, 400, 392 }, // Button 9 - copy of button 3, to be redefined in the code
|
||||
{ 400, 216, 488, 304 }, // Button 10 - copy of button 4, to be redefined in the code
|
||||
{ 312, 216, 400, 304 }, // Button 11 - copy of button 5, to be redefined in the code
|
||||
}
|
||||
: new int[][]
|
||||
{
|
||||
{ 0, 303, 177, 480 }, // Main joystick/DPAD
|
||||
{ 0, 0, 48, 48 }, // Text input button
|
||||
{ 712, 392, 800, 480 }, // Button 0
|
||||
{ 624, 392, 712, 480 }, // Button 1
|
||||
{ 712, 304, 800, 392 }, // Button 2
|
||||
{ 624, 304, 712, 392 }, // Button 3
|
||||
{ 712, 216, 800, 304 }, // Button 4
|
||||
{ 624, 216, 712, 304 }, // Button 5
|
||||
{ 0, 0, 0, 0, }, // Joystick 2
|
||||
{ 0, 0, 0, 0, }, // Joystick 3
|
||||
{ 536, 392, 624, 480 }, // Button 6
|
||||
{ 448, 392, 536, 480 }, // Button 7
|
||||
{ 536, 304, 624, 392 }, // Button 8
|
||||
{ 448, 304, 536, 392 }, // Button 9
|
||||
{ 536, 216, 624, 304 }, // Button 10
|
||||
{ 448, 216, 536, 304 }, // Button 11
|
||||
};
|
||||
public static boolean ScreenKbControlsShown[] = new boolean[ScreenKbControlsLayout.length]; /* Also joystick and text input button added */
|
||||
public static int RemapMultitouchGestureKeycode[] = new int[4];
|
||||
public static boolean MultitouchGesturesUsed[] = new boolean[4];
|
||||
|
||||
@@ -230,20 +230,22 @@ public class Settings
|
||||
Globals.KeepAspectRatio = settingsFile.readBoolean();
|
||||
Globals.MoveMouseWithJoystickSpeed = settingsFile.readInt();
|
||||
Globals.MoveMouseWithJoystickAccel = settingsFile.readInt();
|
||||
int readKeys = settingsFile.readInt();
|
||||
for( int i = 0; i < readKeys; i++ )
|
||||
int readKeysSize = settingsFile.readInt();
|
||||
for( int i = 0; i < readKeysSize; i++ )
|
||||
{
|
||||
Globals.RemapHwKeycode[i] = settingsFile.readInt();
|
||||
}
|
||||
if( settingsFile.readInt() != Globals.RemapScreenKbKeycode.length )
|
||||
int readScreenKbRemapKeysSize = settingsFile.readInt();
|
||||
if( readScreenKbRemapKeysSize > Globals.RemapScreenKbKeycode.length )
|
||||
throw new IOException();
|
||||
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
|
||||
for( int i = 0; i < readScreenKbRemapKeysSize; i++ )
|
||||
{
|
||||
Globals.RemapScreenKbKeycode[i] = settingsFile.readInt();
|
||||
}
|
||||
if( settingsFile.readInt() != Globals.ScreenKbControlsShown.length )
|
||||
int readScreenKbShownSize = settingsFile.readInt();
|
||||
if( readScreenKbShownSize > Globals.ScreenKbControlsShown.length )
|
||||
throw new IOException();
|
||||
for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ )
|
||||
for( int i = 0; i < readScreenKbShownSize; i++ )
|
||||
{
|
||||
Globals.ScreenKbControlsShown[i] = settingsFile.readBoolean();
|
||||
}
|
||||
@@ -270,9 +272,10 @@ public class Settings
|
||||
b.append( settingsFile.readChar() );
|
||||
Globals.CommandLine = b.toString();
|
||||
|
||||
if( settingsFile.readInt() != Globals.ScreenKbControlsLayout.length )
|
||||
int screenKbControlsLayoutSize = settingsFile.readInt();
|
||||
if( screenKbControlsLayoutSize > Globals.ScreenKbControlsLayout.length )
|
||||
throw new IOException();
|
||||
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
|
||||
for( int i = 0; i < screenKbControlsLayoutSize; i++ )
|
||||
for( int ii = 0; ii < 4; ii++ )
|
||||
Globals.ScreenKbControlsLayout[i][ii] = settingsFile.readInt();
|
||||
Globals.LeftClickKey = settingsFile.readInt();
|
||||
@@ -362,12 +365,14 @@ public class Settings
|
||||
}
|
||||
Globals.ScreenKbControlsShown[0] = (Globals.AppNeedsArrowKeys || Globals.AppUsesJoystick);
|
||||
Globals.ScreenKbControlsShown[1] = Globals.AppNeedsTextInput;
|
||||
for( int i = 2; i < Globals.ScreenKbControlsShown.length; i++ )
|
||||
for( int i = 2; i < 8; i++ )
|
||||
Globals.ScreenKbControlsShown[i] = ( i - 2 < Globals.AppTouchscreenKeyboardKeysAmount );
|
||||
if( Globals.AppUsesSecondJoystick )
|
||||
Globals.ScreenKbControlsShown[8] = true;
|
||||
if( Globals.AppUsesThirdJoystick )
|
||||
Globals.ScreenKbControlsShown[9] = true;
|
||||
for( int i = 10; i < Globals.ScreenKbControlsShown.length; i++ )
|
||||
Globals.ScreenKbControlsShown[i] = ( i - 4 < Globals.AppTouchscreenKeyboardKeysAmount );
|
||||
for( int i = 0; i < Globals.RemapMultitouchGestureKeycode.length; i++ )
|
||||
{
|
||||
int sdlKey = nativeGetKeymapKeyMultitouchGesture(i);
|
||||
|
||||
@@ -386,26 +386,22 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 4",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 5",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 6",
|
||||
p.getResources().getString(R.string.remap_screenkb_joystick) + " 2",
|
||||
p.getResources().getString(R.string.remap_screenkb_joystick) + " 3",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 7",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 8",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 9",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 10",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 11",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 12",
|
||||
};
|
||||
|
||||
boolean defaults[] = Arrays.copyOf(Globals.ScreenKbControlsShown, Globals.ScreenKbControlsShown.length);
|
||||
if( Globals.AppUsesSecondJoystick )
|
||||
{
|
||||
items = Arrays.copyOf(items, items.length + 1);
|
||||
items[items.length - 1] = p.getResources().getString(R.string.remap_screenkb_joystick) + " 2";
|
||||
defaults = Arrays.copyOf(defaults, defaults.length + 1);
|
||||
defaults[defaults.length - 1] = true;
|
||||
}
|
||||
if( Globals.AppUsesThirdJoystick )
|
||||
{
|
||||
items = Arrays.copyOf(items, items.length + 1);
|
||||
items[items.length - 1] = p.getResources().getString(R.string.remap_screenkb_joystick) + " 3";
|
||||
defaults = Arrays.copyOf(defaults, defaults.length + 1);
|
||||
defaults[defaults.length - 1] = true;
|
||||
}
|
||||
|
||||
for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
|
||||
items[i+2] = items[i+2] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
|
||||
for( int i = 6; i < Math.min(12, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
|
||||
items[i+4] = items[i+4] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||
builder.setTitle(p.getResources().getString(R.string.remap_screenkb));
|
||||
@@ -445,9 +441,15 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 4",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 5",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 6",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 7",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 8",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 9",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 10",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 11",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 12",
|
||||
};
|
||||
|
||||
for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
|
||||
for( int i = 0; i < Math.min(12, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
|
||||
items[i] = items[i] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
|
||||
|
||||
if( currentButton >= Globals.RemapScreenKbKeycode.length )
|
||||
@@ -657,7 +659,13 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
R.drawable.b5,
|
||||
R.drawable.b6,
|
||||
R.drawable.dpad,
|
||||
R.drawable.dpad
|
||||
R.drawable.dpad,
|
||||
R.drawable.b1,
|
||||
R.drawable.b2,
|
||||
R.drawable.b3,
|
||||
R.drawable.b4,
|
||||
R.drawable.b5,
|
||||
R.drawable.b6,
|
||||
};
|
||||
int oldX = 0, oldY = 0;
|
||||
boolean resizing = false;
|
||||
@@ -780,6 +788,10 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
buttonText = "Joystick 2";
|
||||
if( i == 9 )
|
||||
buttonText = "Joystick 3";
|
||||
if( i >= 10 && i <= 15 )
|
||||
buttonText = p.getResources().getString(R.string.remap_screenkb_button) + (i - 4);
|
||||
if( i >= 10 && i - 4 < Globals.AppTouchscreenKeyboardKeysNames.length )
|
||||
buttonText = Globals.AppTouchscreenKeyboardKeysNames[i - 4].replace("_", " ");
|
||||
p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help) + "\n" + buttonText);
|
||||
}
|
||||
|
||||
@@ -879,7 +891,7 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
p.getResources().getString(R.string.screenkb_floating_joystick),
|
||||
};
|
||||
|
||||
boolean defaults[] = {
|
||||
boolean defaults[] = {
|
||||
Globals.FloatingScreenJoystick,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user