mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
(Menu) Create new input_ctl actions for pointer dragging
This commit is contained in:
parent
242b511387
commit
5a1d8a96d0
@ -471,7 +471,6 @@ static void rgui_render(void *data)
|
|||||||
|
|
||||||
if (settings->menu.pointer.enable)
|
if (settings->menu.pointer.enable)
|
||||||
{
|
{
|
||||||
bool pointer_dragged = false;
|
|
||||||
unsigned new_val;
|
unsigned new_val;
|
||||||
|
|
||||||
menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &old_start);
|
menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &old_start);
|
||||||
@ -480,9 +479,8 @@ static void rgui_render(void *data)
|
|||||||
/ 11 - 2 + old_start;
|
/ 11 - 2 + old_start;
|
||||||
|
|
||||||
menu_input_ctl(MENU_INPUT_CTL_POINTER_PTR, &new_val);
|
menu_input_ctl(MENU_INPUT_CTL_POINTER_PTR, &new_val);
|
||||||
menu_input_ctl(MENU_INPUT_CTL_POINTER_DRAGGING, &pointer_dragged);
|
|
||||||
|
|
||||||
if (pointer_dragged)
|
if (menu_input_ctl(MENU_INPUT_CTL_IS_POINTER_DRAGGED, NULL))
|
||||||
{
|
{
|
||||||
size_t start;
|
size_t start;
|
||||||
int16_t delta_y = menu_input_pointer_state(MENU_POINTER_DELTA_Y_AXIS);
|
int16_t delta_y = menu_input_pointer_state(MENU_POINTER_DELTA_Y_AXIS);
|
||||||
|
@ -104,7 +104,6 @@ typedef struct menu_input
|
|||||||
int16_t dy;
|
int16_t dy;
|
||||||
float accel;
|
float accel;
|
||||||
bool pressed[2];
|
bool pressed[2];
|
||||||
bool dragging;
|
|
||||||
bool back;
|
bool back;
|
||||||
unsigned ptr;
|
unsigned ptr;
|
||||||
} pointer;
|
} pointer;
|
||||||
@ -636,9 +635,10 @@ static bool menu_input_key_bind_iterate(char *s, size_t len)
|
|||||||
bool menu_input_ctl(enum menu_input_ctl_state state, void *data)
|
bool menu_input_ctl(enum menu_input_ctl_state state, void *data)
|
||||||
{
|
{
|
||||||
static char menu_input_keyboard_label_setting[256];
|
static char menu_input_keyboard_label_setting[256];
|
||||||
static const char *menu_input_keyboard_label = NULL;
|
|
||||||
static const char **menu_input_keyboard_buffer;
|
static const char **menu_input_keyboard_buffer;
|
||||||
menu_input_t *menu_input = menu_input_get_ptr();
|
static const char *menu_input_keyboard_label = NULL;
|
||||||
|
static bool pointer_dragging = false;
|
||||||
|
menu_input_t *menu_input = menu_input_get_ptr();
|
||||||
|
|
||||||
if (!menu_input)
|
if (!menu_input)
|
||||||
return false;
|
return false;
|
||||||
@ -674,6 +674,7 @@ bool menu_input_ctl(enum menu_input_ctl_state state, void *data)
|
|||||||
break;
|
break;
|
||||||
case MENU_INPUT_CTL_DEINIT:
|
case MENU_INPUT_CTL_DEINIT:
|
||||||
memset(menu_input, 0, sizeof(menu_input_t));
|
memset(menu_input, 0, sizeof(menu_input_t));
|
||||||
|
pointer_dragging = false;
|
||||||
break;
|
break;
|
||||||
case MENU_INPUT_CTL_SEARCH_START:
|
case MENU_INPUT_CTL_SEARCH_START:
|
||||||
{
|
{
|
||||||
@ -712,11 +713,13 @@ bool menu_input_ctl(enum menu_input_ctl_state state, void *data)
|
|||||||
menu_input->pointer.accel = *ptr;
|
menu_input->pointer.accel = *ptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MENU_INPUT_CTL_POINTER_DRAGGING:
|
case MENU_INPUT_CTL_IS_POINTER_DRAGGED:
|
||||||
{
|
return pointer_dragging;
|
||||||
bool *ptr = (bool*)data;
|
case MENU_INPUT_CTL_SET_POINTER_DRAGGED:
|
||||||
*ptr = menu_input->pointer.dragging;
|
pointer_dragging = true;
|
||||||
}
|
break;
|
||||||
|
case MENU_INPUT_CTL_UNSET_POINTER_DRAGGED:
|
||||||
|
pointer_dragging = false;
|
||||||
break;
|
break;
|
||||||
case MENU_INPUT_CTL_KEYBOARD_DISPLAY:
|
case MENU_INPUT_CTL_KEYBOARD_DISPLAY:
|
||||||
{
|
{
|
||||||
@ -1119,7 +1122,8 @@ static int menu_input_pointer_post_iterate(
|
|||||||
|| abs(pointer_y - start_y) > (dpi / 10))
|
|| abs(pointer_y - start_y) > (dpi / 10))
|
||||||
{
|
{
|
||||||
float s, delta_time;
|
float s, delta_time;
|
||||||
menu_input->pointer.dragging = true;
|
|
||||||
|
menu_input_ctl(MENU_INPUT_CTL_SET_POINTER_DRAGGED, NULL);
|
||||||
menu_input->pointer.dx = pointer_x - pointer_old_x;
|
menu_input->pointer.dx = pointer_x - pointer_old_x;
|
||||||
menu_input->pointer.dy = pointer_y - pointer_old_y;
|
menu_input->pointer.dy = pointer_y - pointer_old_y;
|
||||||
pointer_old_x = pointer_x;
|
pointer_old_x = pointer_x;
|
||||||
@ -1138,7 +1142,7 @@ static int menu_input_pointer_post_iterate(
|
|||||||
{
|
{
|
||||||
if (pointer_oldpressed[0])
|
if (pointer_oldpressed[0])
|
||||||
{
|
{
|
||||||
if (!menu_input->pointer.dragging)
|
if (!menu_input_ctl(MENU_INPUT_CTL_IS_POINTER_DRAGGED, NULL))
|
||||||
{
|
{
|
||||||
menu_ctx_pointer_t point;
|
menu_ctx_pointer_t point;
|
||||||
|
|
||||||
@ -1161,7 +1165,8 @@ static int menu_input_pointer_post_iterate(
|
|||||||
pointer_old_y = 0;
|
pointer_old_y = 0;
|
||||||
menu_input->pointer.dx = 0;
|
menu_input->pointer.dx = 0;
|
||||||
menu_input->pointer.dy = 0;
|
menu_input->pointer.dy = 0;
|
||||||
menu_input->pointer.dragging = false;
|
|
||||||
|
menu_input_ctl(MENU_INPUT_CTL_UNSET_POINTER_DRAGGED, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,9 @@ enum menu_input_ctl_state
|
|||||||
MENU_INPUT_CTL_POINTER_PTR,
|
MENU_INPUT_CTL_POINTER_PTR,
|
||||||
MENU_INPUT_CTL_POINTER_ACCEL_READ,
|
MENU_INPUT_CTL_POINTER_ACCEL_READ,
|
||||||
MENU_INPUT_CTL_POINTER_ACCEL_WRITE,
|
MENU_INPUT_CTL_POINTER_ACCEL_WRITE,
|
||||||
MENU_INPUT_CTL_POINTER_DRAGGING,
|
MENU_INPUT_CTL_IS_POINTER_DRAGGED,
|
||||||
|
MENU_INPUT_CTL_SET_POINTER_DRAGGED,
|
||||||
|
MENU_INPUT_CTL_UNSET_POINTER_DRAGGED,
|
||||||
MENU_INPUT_CTL_KEYBOARD_DISPLAY,
|
MENU_INPUT_CTL_KEYBOARD_DISPLAY,
|
||||||
MENU_INPUT_CTL_SET_KEYBOARD_DISPLAY,
|
MENU_INPUT_CTL_SET_KEYBOARD_DISPLAY,
|
||||||
MENU_INPUT_CTL_KEYBOARD_BUFF_PTR,
|
MENU_INPUT_CTL_KEYBOARD_BUFF_PTR,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user