mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-21 19:41:17 +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)
|
||||
{
|
||||
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
|
||||
{
|
||||
private static final String SUPPORTED_ASCII = "qwertyuiop[]asdfghjkl;'\\<zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:\"|>ZXCVBNM<>?`1234567890-=~!@#$%^&*()_+";
|
||||
private int permissionCount = 0;
|
||||
private static final int READ_EXTERNAL_STORAGE_PERMISSION_ID = 1;
|
||||
private static final int WRITE_EXTERNAL_STORAGE_PERMISSION_ID = 2;
|
||||
|
@ -76,7 +77,10 @@ public class MainActivity extends SDLActivity // implements KeyEvent.Callback
|
|||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
//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
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue