mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-12 12:58:34 +00:00
Add mouse wheel support
enable hold to bind on android cleanup
This commit is contained in:
parent
fef9b63bc0
commit
717e45dc52
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -14,9 +14,6 @@
|
||||
"*.in": "c",
|
||||
"*.rh": "c",
|
||||
"array": "c",
|
||||
"stdlib.h": "c",
|
||||
"cmath": "c",
|
||||
"cstdlib": "c"
|
||||
},
|
||||
"C_Cpp.dimInactiveRegions": false,
|
||||
}
|
@ -52,6 +52,7 @@ enum {
|
||||
AMOTION_EVENT_BUTTON_TERTIARY = 1 << 2,
|
||||
AMOTION_EVENT_BUTTON_BACK = 1 << 3,
|
||||
AMOTION_EVENT_BUTTON_FORWARD = 1 << 4,
|
||||
AMOTION_EVENT_AXIS_VSCROLL = 9,
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -121,7 +122,7 @@ typedef struct android_input
|
||||
unsigned pointer_count;
|
||||
int mouse_x_delta, mouse_y_delta;
|
||||
float mouse_x_prev, mouse_y_prev;
|
||||
int mouse_l, mouse_r, mouse_m;
|
||||
int mouse_l, mouse_r, mouse_m, mouse_wu, mouse_wd;
|
||||
int64_t quick_tap_time;
|
||||
} android_input_t;
|
||||
|
||||
@ -557,7 +558,7 @@ static int16_t android_mouse_state(android_input_t *android, unsigned id)
|
||||
break;
|
||||
case RETRO_DEVICE_ID_MOUSE_MIDDLE:
|
||||
val = android->mouse_m;
|
||||
break;
|
||||
break;
|
||||
case RETRO_DEVICE_ID_MOUSE_X:
|
||||
val = android->mouse_x_delta;
|
||||
android->mouse_x_delta = 0; /* flush delta after it has been read */
|
||||
@ -566,6 +567,14 @@ static int16_t android_mouse_state(android_input_t *android, unsigned id)
|
||||
val = android->mouse_y_delta; /* flush delta after it has been read */
|
||||
android->mouse_y_delta = 0;
|
||||
break;
|
||||
case RETRO_DEVICE_ID_MOUSE_WHEELUP:
|
||||
val = android->mouse_wu;
|
||||
android->mouse_wu = 0;
|
||||
break;
|
||||
case RETRO_DEVICE_ID_MOUSE_WHEELDOWN:
|
||||
val = android->mouse_wd;
|
||||
android->mouse_wd = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return val;
|
||||
@ -674,9 +683,17 @@ static INLINE int android_input_poll_event_type_motion(
|
||||
if (p_AMotionEvent_getButtonState)
|
||||
{
|
||||
btn = (int)AMotionEvent_getButtonState(event);
|
||||
|
||||
android->mouse_l = (btn & AMOTION_EVENT_BUTTON_PRIMARY);
|
||||
android->mouse_r = (btn & AMOTION_EVENT_BUTTON_SECONDARY);
|
||||
android->mouse_m = (btn & AMOTION_EVENT_BUTTON_TERTIARY);
|
||||
|
||||
btn = (int)AMotionEvent_getAxisValue(event, AMOTION_EVENT_AXIS_VSCROLL, motion_ptr);
|
||||
|
||||
if (btn > 0)
|
||||
android->mouse_wu = btn;
|
||||
else if (btn < 0)
|
||||
android->mouse_wd = btn;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1386,7 +1403,8 @@ static int16_t android_input_state(void *data,
|
||||
port, idx, id, binds[port]);
|
||||
break;
|
||||
case RETRO_DEVICE_MOUSE:
|
||||
return android_mouse_state(android, id);
|
||||
ret = android_mouse_state(android, id);
|
||||
return ret;
|
||||
case RETRO_DEVICE_LIGHTGUN:
|
||||
return android_lightgun_device_state(android, id);
|
||||
case RETRO_DEVICE_POINTER:
|
||||
|
@ -585,7 +585,7 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind)
|
||||
input_driver_keyboard_mapping_set_block( true );
|
||||
menu_input_key_bind_poll_bind_state( &binds, menu_bind_port, timed_out );
|
||||
|
||||
#if 0
|
||||
#ifdef ANDROID
|
||||
|
||||
/*keep resetting bind during the hold period, or we'll potentially bind joystick and mouse, etc.*/
|
||||
binds.buffer = *( binds.output );
|
||||
|
Loading…
Reference in New Issue
Block a user