Fixed typo in header file, implemented changing keycodes for on-screen keyboard
This commit is contained in:
@@ -205,7 +205,10 @@ fi
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$RedefinedKeysScreenKb" -o -z "$AUTO" ]; then
|
if [ -z "$RedefinedKeysScreenKb" -o -z "$AUTO" ]; then
|
||||||
echo -n "\nRedefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom and rotate)"
|
if [ -z "$RedefinedKeysScreenKb" ]; then
|
||||||
|
RedefinedKeysScreenKb="$RedefinedKeys"
|
||||||
|
fi
|
||||||
|
echo -n "\nRedefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right)"
|
||||||
echo -n "\n$RedefinedKeysScreenKb - current SDL keycodes"
|
echo -n "\n$RedefinedKeysScreenKb - current SDL keycodes"
|
||||||
echo -n "\n: "
|
echo -n "\n: "
|
||||||
read var
|
read var
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ class Settings
|
|||||||
for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ )
|
for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ )
|
||||||
{
|
{
|
||||||
out.writeBoolean(Globals.ScreenKbControlsShown[i]);
|
out.writeBoolean(Globals.ScreenKbControlsShown[i]);
|
||||||
out.writeInt(Globals.RemapScreenKbKeycode[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out.close();
|
out.close();
|
||||||
@@ -101,20 +100,19 @@ class Settings
|
|||||||
idx = ii;
|
idx = ii;
|
||||||
Globals.RemapHwKeycode[i] = idx;
|
Globals.RemapHwKeycode[i] = idx;
|
||||||
}
|
}
|
||||||
for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ )
|
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
|
||||||
{
|
{
|
||||||
int sdlKey = nativeGetKeymapKeyScreenKb(i);
|
int sdlKey = nativeGetKeymapKeyScreenKb(i);
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for(int ii = 0; ii < SDL_Keys.values.length; ii++)
|
for(int ii = 0; ii < SDL_Keys.values.length; ii++)
|
||||||
if(SDL_Keys.values[ii] == sdlKey)
|
if(SDL_Keys.values[ii] == sdlKey)
|
||||||
idx = ii;
|
idx = ii;
|
||||||
Globals.RemapHwKeycode[i] = idx;
|
|
||||||
Globals.RemapScreenKbKeycode[i] = idx;
|
Globals.RemapScreenKbKeycode[i] = idx;
|
||||||
}
|
}
|
||||||
Globals.ScreenKbControlsShown[0] = Globals.AppNeedsArrowKeys;
|
Globals.ScreenKbControlsShown[0] = Globals.AppNeedsArrowKeys;
|
||||||
for( int i = 1; i < 7; i++ )
|
Globals.ScreenKbControlsShown[1] = Globals.AppNeedsTextInput;
|
||||||
Globals.ScreenKbControlsShown[i] = ( i <= Globals.AppTouchscreenKeyboardKeysAmount );
|
for( int i = 2; i < 7; i++ )
|
||||||
Globals.ScreenKbControlsShown[7] = Globals.AppNeedsTextInput;
|
Globals.ScreenKbControlsShown[i] = ( i - 2 < Globals.AppTouchscreenKeyboardKeysAmount );
|
||||||
for( int i = 8; i < 12; i++ )
|
for( int i = 8; i < 12; i++ )
|
||||||
Globals.ScreenKbControlsShown[i] = true;
|
Globals.ScreenKbControlsShown[i] = true;
|
||||||
|
|
||||||
@@ -160,7 +158,6 @@ class Settings
|
|||||||
for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ )
|
for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ )
|
||||||
{
|
{
|
||||||
Globals.ScreenKbControlsShown[i] = settingsFile.readBoolean();
|
Globals.ScreenKbControlsShown[i] = settingsFile.readBoolean();
|
||||||
Globals.RemapScreenKbKeycode[i] = settingsFile.readInt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsLoaded = true;
|
settingsLoaded = true;
|
||||||
@@ -245,7 +242,8 @@ class Settings
|
|||||||
|
|
||||||
items.add(p.getResources().getString(R.string.remap_hwkeys));
|
items.add(p.getResources().getString(R.string.remap_hwkeys));
|
||||||
|
|
||||||
items.add(p.getResources().getString(R.string.remap_screenkb));
|
if( Globals.UseTouchscreenKeyboard )
|
||||||
|
items.add(p.getResources().getString(R.string.remap_screenkb));
|
||||||
|
|
||||||
items.add(p.getResources().getString(R.string.ok));
|
items.add(p.getResources().getString(R.string.ok));
|
||||||
|
|
||||||
@@ -325,8 +323,11 @@ class Settings
|
|||||||
showRemapHwKeysConfig(p);
|
showRemapHwKeysConfig(p);
|
||||||
selected++;
|
selected++;
|
||||||
|
|
||||||
if( item == selected )
|
if( ! Globals.UseTouchscreenKeyboard )
|
||||||
showRemapScreenKbConfig(p);
|
item += 1;
|
||||||
|
else
|
||||||
|
if( item == selected )
|
||||||
|
showRemapScreenKbConfig(p);
|
||||||
selected++;
|
selected++;
|
||||||
|
|
||||||
if( item == selected )
|
if( item == selected )
|
||||||
@@ -947,10 +948,13 @@ class Settings
|
|||||||
p.getResources().getString(R.string.remap_screenkb_button) + " 4",
|
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) + " 5",
|
||||||
p.getResources().getString(R.string.remap_screenkb_button) + " 6",
|
p.getResources().getString(R.string.remap_screenkb_button) + " 6",
|
||||||
|
// Not implemented yet!
|
||||||
|
/*
|
||||||
p.getResources().getString(R.string.remap_screenkb_button_zoomin),
|
p.getResources().getString(R.string.remap_screenkb_button_zoomin),
|
||||||
p.getResources().getString(R.string.remap_screenkb_button_zoomout),
|
p.getResources().getString(R.string.remap_screenkb_button_zoomout),
|
||||||
p.getResources().getString(R.string.remap_screenkb_button_rotateleft),
|
p.getResources().getString(R.string.remap_screenkb_button_rotateleft),
|
||||||
p.getResources().getString(R.string.remap_screenkb_button_rotateright),
|
p.getResources().getString(R.string.remap_screenkb_button_rotateright),
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
boolean defaults[] = {
|
boolean defaults[] = {
|
||||||
@@ -962,12 +966,16 @@ class Settings
|
|||||||
Globals.ScreenKbControlsShown[5],
|
Globals.ScreenKbControlsShown[5],
|
||||||
Globals.ScreenKbControlsShown[6],
|
Globals.ScreenKbControlsShown[6],
|
||||||
Globals.ScreenKbControlsShown[7],
|
Globals.ScreenKbControlsShown[7],
|
||||||
|
// Not implemented yet!
|
||||||
|
/*
|
||||||
Globals.ScreenKbControlsShown[8],
|
Globals.ScreenKbControlsShown[8],
|
||||||
Globals.ScreenKbControlsShown[9],
|
Globals.ScreenKbControlsShown[9],
|
||||||
Globals.ScreenKbControlsShown[10],
|
Globals.ScreenKbControlsShown[10],
|
||||||
Globals.ScreenKbControlsShown[11],
|
Globals.ScreenKbControlsShown[11],
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if( ! Globals.UseTouchscreenKeyboard )
|
if( ! Globals.UseTouchscreenKeyboard )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < 8; i++ )
|
for( int i = 0; i < 8; i++ )
|
||||||
@@ -1025,13 +1033,16 @@ class Settings
|
|||||||
p.getResources().getString(R.string.remap_screenkb_button) + " 4",
|
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) + " 5",
|
||||||
p.getResources().getString(R.string.remap_screenkb_button) + " 6",
|
p.getResources().getString(R.string.remap_screenkb_button) + " 6",
|
||||||
|
// Not implemented yet!
|
||||||
|
/*
|
||||||
p.getResources().getString(R.string.remap_screenkb_button_zoomin),
|
p.getResources().getString(R.string.remap_screenkb_button_zoomin),
|
||||||
p.getResources().getString(R.string.remap_screenkb_button_zoomout),
|
p.getResources().getString(R.string.remap_screenkb_button_zoomout),
|
||||||
p.getResources().getString(R.string.remap_screenkb_button_rotateleft),
|
p.getResources().getString(R.string.remap_screenkb_button_rotateleft),
|
||||||
p.getResources().getString(R.string.remap_screenkb_button_rotateright),
|
p.getResources().getString(R.string.remap_screenkb_button_rotateright),
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
if( currentButton >= Globals.RemapScreenKbKeycode.length )
|
if( currentButton >= items.length ) // Globals.RemapScreenKbKeycode.length )
|
||||||
{
|
{
|
||||||
showConfigMainMenu(p);
|
showConfigMainMenu(p);
|
||||||
return;
|
return;
|
||||||
@@ -1088,10 +1099,10 @@ class Settings
|
|||||||
nativeSetTouchscreenKeyboardUsed();
|
nativeSetTouchscreenKeyboardUsed();
|
||||||
nativeSetupScreenKeyboard( Globals.TouchscreenKeyboardSize,
|
nativeSetupScreenKeyboard( Globals.TouchscreenKeyboardSize,
|
||||||
Globals.TouchscreenKeyboardTheme,
|
Globals.TouchscreenKeyboardTheme,
|
||||||
Globals.AppTouchscreenKeyboardKeysAmount,
|
7, // Globals.AppTouchscreenKeyboardKeysAmount, - set later by nativeSetScreenKbKeyUsed()
|
||||||
Globals.AppTouchscreenKeyboardKeysAmountAutoFire,
|
Globals.AppTouchscreenKeyboardKeysAmountAutoFire,
|
||||||
Globals.AppNeedsArrowKeys ? 1 : 0,
|
1, //Globals.AppNeedsArrowKeys ? 1 : 0,
|
||||||
Globals.AppNeedsTextInput ? 1 : 0 );
|
1 ); //Globals.AppNeedsTextInput ? 1 : 0 );
|
||||||
}
|
}
|
||||||
SetupTouchscreenKeyboardGraphics(p);
|
SetupTouchscreenKeyboardGraphics(p);
|
||||||
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
|
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
|
||||||
@@ -1101,7 +1112,9 @@ class Settings
|
|||||||
|
|
||||||
for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ )
|
for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ )
|
||||||
{
|
{
|
||||||
nativeSetKeymapKeyScreenKb(i, i >= 2 ? SDL_Keys.values[Globals.RemapScreenKbKeycode[i-2]] : 0, Globals.ScreenKbControlsShown[i] ? 1 : 0);
|
nativeSetScreenKbKeyUsed(i, Globals.ScreenKbControlsShown[i] ? 1 : 0);
|
||||||
|
if( i >= 2 )
|
||||||
|
nativeSetKeymapKeyScreenKb(i, SDL_Keys.values[Globals.RemapScreenKbKeycode[i-2]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
String lang = new String(Locale.getDefault().getLanguage());
|
String lang = new String(Locale.getDefault().getLanguage());
|
||||||
@@ -1156,9 +1169,10 @@ class Settings
|
|||||||
private static native void nativeSetupScreenKeyboardButtons(byte[] img);
|
private static native void nativeSetupScreenKeyboardButtons(byte[] img);
|
||||||
private static native void nativeInitKeymap();
|
private static native void nativeInitKeymap();
|
||||||
private static native int nativeGetKeymapKey(int key);
|
private static native int nativeGetKeymapKey(int key);
|
||||||
private static native int nativeGetKeymapKeyScreenKb(int key);
|
|
||||||
private static native void nativeSetKeymapKey(int javakey, int key);
|
private static native void nativeSetKeymapKey(int javakey, int key);
|
||||||
private static native void nativeSetKeymapKeyScreenKb(int javakey, int key, int used);
|
private static native int nativeGetKeymapKeyScreenKb(int keynum);
|
||||||
|
private static native void nativeSetKeymapKeyScreenKb(int keynum, int key);
|
||||||
|
private static native void nativeSetScreenKbKeyUsed(int keynum, int used);
|
||||||
public static native void nativeSetEnv(final String name, final String value);
|
public static native void nativeSetEnv(final String name, final String value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
<string name="controls_screenkb_small">Small</string>
|
<string name="controls_screenkb_small">Small</string>
|
||||||
<string name="controls_screenkb_tiny">Tiny</string>
|
<string name="controls_screenkb_tiny">Tiny</string>
|
||||||
<string name="controls_screenkb_theme">On-screen keyboard theme</string>
|
<string name="controls_screenkb_theme">On-screen keyboard theme</string>
|
||||||
<string name="controls_screenkb_by">%1$s by %1$s</string>
|
<string name="controls_screenkb_by">%1$s by %2$s</string>
|
||||||
|
|
||||||
<string name="trackball_no_dampening">No dampening</string>
|
<string name="trackball_no_dampening">No dampening</string>
|
||||||
<string name="trackball_fast">Fast</string>
|
<string name="trackball_fast">Fast</string>
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ static int try_init()
|
|||||||
{
|
{
|
||||||
// Disable DPAD
|
// Disable DPAD
|
||||||
SDL_Rect pos = {0, 0, 0, 0};
|
SDL_Rect pos = {0, 0, 0, 0};
|
||||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_DPAD, &pos);
|
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, &pos);
|
||||||
|
|
||||||
// Rope button in lower-right
|
// Rope button in lower-right
|
||||||
pos.x = screen_width;
|
pos.x = screen_width;
|
||||||
@@ -321,7 +321,7 @@ static int try_init()
|
|||||||
pos.x -= pos.w;
|
pos.x -= pos.w;
|
||||||
pos.y -= pos.h;
|
pos.y -= pos.h;
|
||||||
|
|
||||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_0, &pos);
|
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &pos);
|
||||||
|
|
||||||
// Move and jump buttons overlapped in lower-left
|
// Move and jump buttons overlapped in lower-left
|
||||||
pos.x = 0;
|
pos.x = 0;
|
||||||
@@ -330,18 +330,18 @@ static int try_init()
|
|||||||
pos.h = pos.w*1.5;
|
pos.h = pos.w*1.5;
|
||||||
pos.y -= pos.h;
|
pos.y -= pos.h;
|
||||||
|
|
||||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_2, &pos);
|
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, &pos);
|
||||||
|
|
||||||
pos.x += pos.w;
|
pos.x += pos.w;
|
||||||
|
|
||||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_3, &pos);
|
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, &pos);
|
||||||
|
|
||||||
pos.w *= 2;
|
pos.w *= 2;
|
||||||
pos.h = pos.w*2/3;
|
pos.h = pos.w*2/3;
|
||||||
pos.x = 0;
|
pos.x = 0;
|
||||||
pos.y -= pos.h/2;
|
pos.y -= pos.h/2;
|
||||||
|
|
||||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_1, &pos);
|
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, &pos);
|
||||||
|
|
||||||
// weapprev weapnext buttons
|
// weapprev weapnext buttons
|
||||||
|
|
||||||
@@ -351,11 +351,11 @@ static int try_init()
|
|||||||
pos.h = pos.w;
|
pos.h = pos.w;
|
||||||
pos.x -= pos.w;
|
pos.x -= pos.w;
|
||||||
|
|
||||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_5, &pos);
|
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_5, &pos);
|
||||||
|
|
||||||
pos.x = 0;
|
pos.x = 0;
|
||||||
|
|
||||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_4, &pos);
|
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_4, &pos);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -38,17 +38,18 @@ extern "C" {
|
|||||||
/* Button IDs */
|
/* Button IDs */
|
||||||
enum {
|
enum {
|
||||||
|
|
||||||
SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_DPAD = 0, /* Joystick/D-Pad button */
|
SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD = 0, /* Joystick/D-Pad button */
|
||||||
|
|
||||||
SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_0, /* Main (usually Fire) button */
|
SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, /* Main (usually Fire) button */
|
||||||
SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_1,
|
SDL_ANDROID_SCREENKEYBOARD_BUTTON_1,
|
||||||
SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_2,
|
SDL_ANDROID_SCREENKEYBOARD_BUTTON_2,
|
||||||
SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_3,
|
SDL_ANDROID_SCREENKEYBOARD_BUTTON_3,
|
||||||
SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_4,
|
SDL_ANDROID_SCREENKEYBOARD_BUTTON_4,
|
||||||
SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_5,
|
SDL_ANDROID_SCREENKEYBOARD_BUTTON_5,
|
||||||
SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_6, /* Button to show screen keyboard */
|
|
||||||
|
|
||||||
SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_MAX = SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_6
|
SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, /* Button to show screen keyboard */
|
||||||
|
|
||||||
|
SDL_ANDROID_SCREENKEYBOARD_BUTTON_MAX = SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT
|
||||||
};
|
};
|
||||||
|
|
||||||
/* All functions return 0 on failure and 1 on success */
|
/* All functions return 0 on failure and 1 on success */
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include "../SDL_sysvideo.h"
|
#include "../SDL_sysvideo.h"
|
||||||
#include "SDL_androidvideo.h"
|
#include "SDL_androidvideo.h"
|
||||||
#include "SDL_androidinput.h"
|
#include "SDL_androidinput.h"
|
||||||
|
#include "SDL_screenkeyboard.h"
|
||||||
#include "jniwrapperstuff.h"
|
#include "jniwrapperstuff.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -1244,6 +1245,44 @@ JAVA_EXPORT_NAME(Settings_nativeSetKeymapKey) ( JNIEnv* env, jobject thiz, jint
|
|||||||
SDL_android_keymap[javakey] = key;
|
SDL_android_keymap[javakey] = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
JAVA_EXPORT_NAME(Settings_nativeGetKeymapKeyScreenKb) ( JNIEnv* env, jobject thiz, jint keynum)
|
||||||
|
{
|
||||||
|
if( keynum < 0 || keynum > SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 + 4 )
|
||||||
|
return SDL_KEY(UNKNOWN);
|
||||||
|
|
||||||
|
if( keynum <= SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 )
|
||||||
|
return SDL_ANDROID_GetScreenKeyboardButtonKey(keynum + SDL_ANDROID_SCREENKEYBOARD_BUTTON_0);
|
||||||
|
|
||||||
|
return SDL_KEY(UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
JAVA_EXPORT_NAME(Settings_nativeSetKeymapKeyScreenKb) ( JNIEnv* env, jobject thiz, jint keynum, jint key)
|
||||||
|
{
|
||||||
|
if( keynum < 0 || keynum > SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 + 4 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( keynum <= SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 )
|
||||||
|
SDL_ANDROID_SetScreenKeyboardButtonKey(keynum + SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
JAVA_EXPORT_NAME(Settings_nativeSetScreenKbKeyUsed) ( JNIEnv* env, jobject thiz, jint keynum, jint used)
|
||||||
|
{
|
||||||
|
SDL_Rect rect = {0, 0, 0, 0};
|
||||||
|
int key = -1;
|
||||||
|
if( keynum == 0 )
|
||||||
|
key = SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD;
|
||||||
|
if( keynum == 1 )
|
||||||
|
key = SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT;
|
||||||
|
if( keynum - 2 > 0 && keynum - 2 < SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 )
|
||||||
|
key = keynum - 2 + SDL_ANDROID_SCREENKEYBOARD_BUTTON_0;
|
||||||
|
|
||||||
|
if( key >= 0 && !used )
|
||||||
|
SDL_ANDROID_SetScreenKeyboardButtonPos(key, &rect);
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
JAVA_EXPORT_NAME(Settings_nativeInitKeymap) ( JNIEnv* env, jobject thiz )
|
JAVA_EXPORT_NAME(Settings_nativeInitKeymap) ( JNIEnv* env, jobject thiz )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ FONT_BTN1 = 4, FONT_BTN2 = 5, FONT_BTN3 = 6, FONT_BTN4 = 7
|
|||||||
static GLshort fontGL[sizeof(font)/sizeof(font[0])][FONT_MAX_LINES_PER_CHAR * 4 + 1];
|
static GLshort fontGL[sizeof(font)/sizeof(font[0])][FONT_MAX_LINES_PER_CHAR * 4 + 1];
|
||||||
enum { FONT_CHAR_LINES_COUNT = FONT_MAX_LINES_PER_CHAR * 4 };
|
enum { FONT_CHAR_LINES_COUNT = FONT_MAX_LINES_PER_CHAR * 4 };
|
||||||
|
|
||||||
enum { MAX_BUTTONS = SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_MAX, MAX_BUTTONS_AUTOFIRE = 2, BUTTON_TEXT_INPUT = MAX_BUTTONS - 1 } ; // Max amount of custom buttons
|
enum { MAX_BUTTONS = SDL_ANDROID_SCREENKEYBOARD_BUTTON_MAX, MAX_BUTTONS_AUTOFIRE = 2, BUTTON_TEXT_INPUT = SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT } ; // Max amount of custom buttons
|
||||||
|
|
||||||
int SDL_ANDROID_isTouchscreenKeyboardUsed = 0;
|
int SDL_ANDROID_isTouchscreenKeyboardUsed = 0;
|
||||||
static int touchscreenKeyboardTheme = 0;
|
static int touchscreenKeyboardTheme = 0;
|
||||||
@@ -70,8 +70,7 @@ SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_1)),
|
|||||||
SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_2)),
|
SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_2)),
|
||||||
SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_3)),
|
SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_3)),
|
||||||
SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_4)),
|
SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_4)),
|
||||||
SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_5)),
|
SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_5))
|
||||||
0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { ARROW_LEFT = 1, ARROW_RIGHT = 2, ARROW_UP = 4, ARROW_DOWN = 8 };
|
enum { ARROW_LEFT = 1, ARROW_RIGHT = 2, ARROW_UP = 4, ARROW_DOWN = 8 };
|
||||||
@@ -849,10 +848,10 @@ JAVA_EXPORT_NAME(Settings_nativeSetupScreenKeyboardButtons) ( JNIEnv* env, jobj
|
|||||||
|
|
||||||
int SDL_ANDROID_SetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos)
|
int SDL_ANDROID_SetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos)
|
||||||
{
|
{
|
||||||
if( buttonId < 0 || buttonId > SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_MAX || ! pos )
|
if( buttonId < 0 || buttonId > SDL_ANDROID_SCREENKEYBOARD_BUTTON_MAX || ! pos )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if( buttonId == SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_DPAD )
|
if( buttonId == SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD )
|
||||||
{
|
{
|
||||||
arrows = *pos;
|
arrows = *pos;
|
||||||
if(touchscreenKeyboardTheme == 0)
|
if(touchscreenKeyboardTheme == 0)
|
||||||
@@ -865,10 +864,10 @@ int SDL_ANDROID_SetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buttons[buttonId - SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_0] = *pos;
|
buttons[buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0] = *pos;
|
||||||
if(touchscreenKeyboardTheme == 0)
|
if(touchscreenKeyboardTheme == 0)
|
||||||
{
|
{
|
||||||
int i = buttonId - SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_0;
|
int i = buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0;
|
||||||
prepareFontCharWireframe(FONT_BTN1 + i, MIN(buttons[i].h, buttons[i].w), MIN(buttons[i].h, buttons[i].w));
|
prepareFontCharWireframe(FONT_BTN1 + i, MIN(buttons[i].h, buttons[i].w), MIN(buttons[i].h, buttons[i].w));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -877,37 +876,35 @@ int SDL_ANDROID_SetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos)
|
|||||||
|
|
||||||
int SDL_ANDROID_GetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos)
|
int SDL_ANDROID_GetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos)
|
||||||
{
|
{
|
||||||
if( buttonId < 0 || buttonId > SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_MAX || ! pos )
|
if( buttonId < 0 || buttonId > SDL_ANDROID_SCREENKEYBOARD_BUTTON_MAX || ! pos )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if( buttonId == SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_DPAD )
|
if( buttonId == SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD )
|
||||||
{
|
{
|
||||||
*pos = arrows;
|
*pos = arrows;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pos = buttons[buttonId - SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_0];
|
*pos = buttons[buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0];
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
int SDL_ANDROID_SetScreenKeyboardButtonKey(int buttonId, SDLKey key)
|
int SDL_ANDROID_SetScreenKeyboardButtonKey(int buttonId, SDLKey key)
|
||||||
{
|
{
|
||||||
if( buttonId < 0 || buttonId > SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_MAX || ! key )
|
if( buttonId < SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 || buttonId > SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 || ! key )
|
||||||
return 0;
|
return 0;
|
||||||
if( buttonId == SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_DPAD )
|
buttonKeysyms[buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0] = key;
|
||||||
return 0;
|
|
||||||
buttonKeysyms[buttonId - SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_0] = key;
|
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
SDLKey SDL_ANDROID_GetScreenKeyboardButtonKey(int buttonId)
|
SDLKey SDL_ANDROID_GetScreenKeyboardButtonKey(int buttonId)
|
||||||
{
|
{
|
||||||
if( buttonId < 0 || buttonId > SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_MAX )
|
if( buttonId < SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 || buttonId > SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 )
|
||||||
return SDLK_UNKNOWN;
|
return SDLK_UNKNOWN;
|
||||||
if( buttonId == SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_DPAD )
|
if( buttonId == SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD )
|
||||||
return SDLK_UNKNOWN;
|
return SDLK_UNKNOWN;
|
||||||
return buttonKeysyms[buttonId - SDL_ANDRIOD_SCREENKEYBOARD_BUTTON_0];
|
return buttonKeysyms[buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0];
|
||||||
};
|
};
|
||||||
|
|
||||||
int SDL_ANDROID_SetScreenKeyboardAutoFireButtonsAmount(int nbuttons)
|
int SDL_ANDROID_SetScreenKeyboardAutoFireButtonsAmount(int nbuttons)
|
||||||
@@ -943,3 +940,4 @@ int SDL_ANDROID_ToggleScreenKeyboardTextInput()
|
|||||||
SDL_ANDROID_CallJavaShowScreenKeyboard();
|
SDL_ANDROID_CallJavaShowScreenKeyboard();
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user