mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-19 21:10:11 -07:00
Check the ES version before launching, add a more proper way to detect the keyboard
This commit is contained in:
parent
06f1d58993
commit
315ad94100
3 changed files with 113 additions and 6 deletions
|
|
@ -775,9 +775,17 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
}
|
||||
}
|
||||
}
|
||||
boolean isKeyboard(KeyEvent evt) {
|
||||
if((evt.getFlags() & KeyEvent.FLAG_SOFT_KEYBOARD) == KeyEvent.FLAG_SOFT_KEYBOARD) return true;
|
||||
if(evt.getSource() == InputDevice.SOURCE_KEYBOARD) return true;
|
||||
if(evt.getUnicodeChar() != 0) return true;
|
||||
if(AndroidLWJGLKeycode.androidToLwjglMap.containsKey(evt.getKeyCode())) return true;
|
||||
return false;
|
||||
}
|
||||
byte[] kevArray = new byte[8];
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
System.out.println(event.getSource() + " "+ event.getFlags());
|
||||
if(event.getSource() == InputDevice.SOURCE_CLASS_JOYSTICK) {
|
||||
switch(event.getKeyCode()) {
|
||||
case KeyEvent.KEYCODE_BUTTON_A:
|
||||
|
|
@ -799,9 +807,9 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
}
|
||||
CallbackBridge.nativePutControllerButtons(ByteBuffer.wrap(kevArray));
|
||||
return true;
|
||||
}else if((event.getFlags() & KeyEvent.FLAG_SOFT_KEYBOARD) == KeyEvent.FLAG_SOFT_KEYBOARD || event.getSource() == InputDevice.SOURCE_KEYBOARD) {
|
||||
}else if(isKeyboard(event)) {
|
||||
AndroidLWJGLKeycode.execKey(event,event.getKeyCode(),event.getAction() == KeyEvent.ACTION_DOWN);
|
||||
return false;
|
||||
return true;
|
||||
}else return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue