Added MetaKey(WindowKey) Packet

Allows you to use Windows key combinations.

ex) Win+Tab , Win+D
This commit is contained in:
luten145 2022-11-13 12:53:25 +09:00 committed by Cameron Gutman
parent 56eddff8d6
commit 26bff28e4d
2 changed files with 9 additions and 1 deletions

View File

@ -1164,6 +1164,10 @@ public class Game extends Activity implements SurfaceHolder.Callback,
androidKeyCode == KeyEvent.KEYCODE_ALT_RIGHT) { androidKeyCode == KeyEvent.KEYCODE_ALT_RIGHT) {
modifierMask = KeyboardPacket.MODIFIER_ALT; modifierMask = KeyboardPacket.MODIFIER_ALT;
} }
else if (androidKeyCode == KeyEvent.KEYCODE_META_LEFT ||
androidKeyCode == KeyEvent.KEYCODE_META_RIGHT) {
modifierMask = KeyboardPacket.MODIFIER_META;
}
if (down) { if (down) {
this.modifierFlags |= modifierMask; this.modifierFlags |= modifierMask;
@ -1226,6 +1230,9 @@ public class Game extends Activity implements SurfaceHolder.Callback,
if (event.isAltPressed()) { if (event.isAltPressed()) {
modifier |= KeyboardPacket.MODIFIER_ALT; modifier |= KeyboardPacket.MODIFIER_ALT;
} }
if (event.isMetaPressed()) {
modifier |= KeyboardPacket.MODIFIER_META;
}
return modifier; return modifier;
} }

View File

@ -7,4 +7,5 @@ public class KeyboardPacket {
public static final byte MODIFIER_SHIFT = 0x01; public static final byte MODIFIER_SHIFT = 0x01;
public static final byte MODIFIER_CTRL = 0x02; public static final byte MODIFIER_CTRL = 0x02;
public static final byte MODIFIER_ALT = 0x04; public static final byte MODIFIER_ALT = 0x04;
public static final byte MODIFIER_META = 0x08;
} }