mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-12-26 15:29:19 +00:00
Expose all three touch interfaces in the sprouting menu for easier switching
This commit is contained in:
parent
2cd1be791a
commit
2cd60c3c88
@ -64,6 +64,7 @@ public class Apple2Activity extends Activity {
|
||||
public final static long NATIVE_TOUCH_KBD = (1 << 5);
|
||||
public final static long NATIVE_TOUCH_JOY = (1 << 6);
|
||||
public final static long NATIVE_TOUCH_MENU = (1 << 7);
|
||||
public final static long NATIVE_TOUCH_JOY_KPAD = (1 << 8);
|
||||
|
||||
public final static long NATIVE_TOUCH_INPUT_DEVICE_CHANGED = (1 << 16);
|
||||
public final static long NATIVE_TOUCH_CPU_SPEED_DEC = (1 << 17);
|
||||
@ -370,11 +371,19 @@ public class Apple2Activity extends Activity {
|
||||
// handle menu-specific actions
|
||||
|
||||
if ((nativeFlags & NATIVE_TOUCH_INPUT_DEVICE_CHANGED) != 0) {
|
||||
int touchDevice = Apple2Preferences.nativeGetCurrentTouchDevice();
|
||||
Apple2Preferences.TouchDeviceVariant nextVariant = Apple2Preferences.TouchDeviceVariant.next(touchDevice);
|
||||
Apple2Preferences.TouchDeviceVariant nextVariant;
|
||||
if ((nativeFlags & NATIVE_TOUCH_KBD) != 0) {
|
||||
nextVariant = Apple2Preferences.TouchDeviceVariant.KEYBOARD;
|
||||
} else if ((nativeFlags & NATIVE_TOUCH_JOY) != 0) {
|
||||
nextVariant = Apple2Preferences.TouchDeviceVariant.JOYSTICK;
|
||||
} else if ((nativeFlags & NATIVE_TOUCH_JOY_KPAD) != 0) {
|
||||
nextVariant = Apple2Preferences.TouchDeviceVariant.JOYSTICK_KEYPAD;
|
||||
} else {
|
||||
int touchDevice = Apple2Preferences.nativeGetCurrentTouchDevice();
|
||||
nextVariant = Apple2Preferences.TouchDeviceVariant.next(touchDevice);
|
||||
}
|
||||
Apple2Preferences.CURRENT_TOUCH_DEVICE.saveTouchDevice(this, nextVariant);
|
||||
}
|
||||
if ((nativeFlags & NATIVE_TOUCH_CPU_SPEED_DEC) != 0) {
|
||||
} else if ((nativeFlags & NATIVE_TOUCH_CPU_SPEED_DEC) != 0) {
|
||||
int percentSpeed = Apple2Preferences.nativeGetCPUSpeed();
|
||||
if (percentSpeed > 100) {
|
||||
percentSpeed -= 25;
|
||||
@ -382,8 +391,7 @@ public class Apple2Activity extends Activity {
|
||||
percentSpeed -= 5;
|
||||
}
|
||||
Apple2Preferences.CPU_SPEED_PERCENT.saveInt(this, percentSpeed);
|
||||
}
|
||||
if ((nativeFlags & NATIVE_TOUCH_CPU_SPEED_INC) != 0) {
|
||||
} else if ((nativeFlags & NATIVE_TOUCH_CPU_SPEED_INC) != 0) {
|
||||
int percentSpeed = Apple2Preferences.nativeGetCPUSpeed();
|
||||
if (percentSpeed >= 100) {
|
||||
percentSpeed += 25;
|
||||
|
@ -69,6 +69,7 @@ typedef enum interface_touch_event_flags {
|
||||
TOUCH_FLAGS_KBD = (1<<5),
|
||||
TOUCH_FLAGS_JOY = (1<<6),
|
||||
TOUCH_FLAGS_MENU = (1<<7),
|
||||
TOUCH_FLAGS_JOY_KPAD = (1<<8),
|
||||
TOUCH_FLAGS_INPUT_DEVICE_CHANGE = (1<<16),
|
||||
TOUCH_FLAGS_CPU_SPEED_DEC = (1<<17),
|
||||
TOUCH_FLAGS_CPU_SPEED_INC = (1<<18),
|
||||
|
@ -98,16 +98,17 @@ static inline void _show_top_left(void) {
|
||||
topMenuTemplate[0][1] = MOUSETEXT_RIGHT;
|
||||
|
||||
if (joydriver_ownsScreen()) {
|
||||
topMenuTemplate[1][0] = ICONTEXT_UPPERCASE;
|
||||
if (joydriver_getTouchVariant() == EMULATED_JOYSTICK) {
|
||||
topMenuTemplate[1][0] = ICONTEXT_MENU_TOUCHJOY_KPAD;
|
||||
topMenuTemplate[1][1] = ICONTEXT_MENU_TOUCHJOY_KPAD;
|
||||
} else {
|
||||
topMenuTemplate[1][0] = ICONTEXT_UPPERCASE;
|
||||
topMenuTemplate[1][1] = ICONTEXT_MENU_TOUCHJOY;
|
||||
}
|
||||
} else {
|
||||
topMenuTemplate[1][0] = ICONTEXT_MENU_TOUCHJOY;
|
||||
topMenuTemplate[1][1] = ICONTEXT_MENU_TOUCHJOY_KPAD;
|
||||
}
|
||||
|
||||
topMenuTemplate[1][1] = ICONTEXT_NONACTIONABLE;
|
||||
menu.topLeftShowing = true;
|
||||
_present_menu(menu.model);
|
||||
}
|
||||
@ -279,10 +280,23 @@ static inline int64_t _tap_menu_item(float x, float y) {
|
||||
break;
|
||||
|
||||
case ICONTEXT_MENU_TOUCHJOY:
|
||||
case ICONTEXT_MENU_TOUCHJOY_KPAD:
|
||||
case ICONTEXT_UPPERCASE:
|
||||
LOG("switching input device ...");
|
||||
LOG("switching to joystick ...");
|
||||
flags |= TOUCH_FLAGS_INPUT_DEVICE_CHANGE;
|
||||
flags |= TOUCH_FLAGS_JOY;
|
||||
_hide_top_left();
|
||||
break;
|
||||
|
||||
case ICONTEXT_MENU_TOUCHJOY_KPAD:
|
||||
LOG("switching to keypad joystick ...");
|
||||
flags |= TOUCH_FLAGS_INPUT_DEVICE_CHANGE;
|
||||
flags |= TOUCH_FLAGS_JOY_KPAD;
|
||||
_hide_top_left();
|
||||
break;
|
||||
|
||||
case ICONTEXT_UPPERCASE:
|
||||
LOG("switching to keyboard ...");
|
||||
flags |= TOUCH_FLAGS_INPUT_DEVICE_CHANGE;
|
||||
flags |= TOUCH_FLAGS_KBD;
|
||||
_hide_top_left();
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user