mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-22 03:51:40 +00:00
Handle only suppoted characters
This commit is contained in:
parent
8bb0124fe6
commit
91fa5bcf3b
2 changed files with 7 additions and 3 deletions
|
@ -38,9 +38,9 @@ JNIEXPORT void JNICALL Java_com_drbeef_ioq3quest_MainActivity_nativeFocusChanged
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_com_drbeef_ioq3quest_MainActivity_nativeKey(JNIEnv *env, jclass clazz, jint keycode, jint action)
|
JNIEXPORT void JNICALL Java_com_drbeef_ioq3quest_MainActivity_nativeKey(JNIEnv *env, jclass clazz, jint keycode, jint action)
|
||||||
{
|
{
|
||||||
if ((action == 0) || (action == 1))
|
if (action == 0)
|
||||||
{
|
{
|
||||||
Com_QueueEvent( 0, SE_CHAR, keycode, action == 0, 0, NULL );
|
Com_QueueEvent( 0, SE_CHAR, keycode, qtrue, 0, NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ import static android.system.Os.setenv;
|
||||||
|
|
||||||
public class MainActivity extends SDLActivity // implements KeyEvent.Callback
|
public class MainActivity extends SDLActivity // implements KeyEvent.Callback
|
||||||
{
|
{
|
||||||
|
private static final String SUPPORTED_ASCII = "qwertyuiop[]asdfghjkl;'\\<zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:\"|>ZXCVBNM<>?`1234567890-=~!@#$%^&*()_+";
|
||||||
private int permissionCount = 0;
|
private int permissionCount = 0;
|
||||||
private static final int READ_EXTERNAL_STORAGE_PERMISSION_ID = 1;
|
private static final int READ_EXTERNAL_STORAGE_PERMISSION_ID = 1;
|
||||||
private static final int WRITE_EXTERNAL_STORAGE_PERMISSION_ID = 2;
|
private static final int WRITE_EXTERNAL_STORAGE_PERMISSION_ID = 2;
|
||||||
|
@ -76,7 +77,10 @@ public class MainActivity extends SDLActivity // implements KeyEvent.Callback
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||||
//ASCII characters directly passed into the engine
|
//ASCII characters directly passed into the engine
|
||||||
nativeKey(event.getKeyCode(), event.getAction());
|
if (SUPPORTED_ASCII.indexOf(event.getUnicodeChar()) >= 0) {
|
||||||
|
nativeKey(event.getUnicodeChar(), event.getAction());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
//special keys using SDL
|
//special keys using SDL
|
||||||
return super.dispatchKeyEvent(event);
|
return super.dispatchKeyEvent(event);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue