Add MENU_CTL_POINTER_PTR

This commit is contained in:
twinaphex 2015-09-24 19:56:53 +02:00
parent aed44e970c
commit 08f24aae4b
4 changed files with 13 additions and 6 deletions

View File

@ -234,11 +234,12 @@ static void glui_render(void)
if (settings->menu.pointer.enable)
{
int16_t pointer_y = menu_input_pointer_state(MENU_POINTER_Y_AXIS);
menu_input->pointer.ptr =
unsigned new_pointer_val =
(pointer_y - glui->line_height + menu->scroll_y - 16)
/ glui->line_height;
menu_input_ctl(MENU_CTL_POINTER_PTR, &new_pointer_val);
menu->scroll_y -= menu_input->pointer.accel / 60.0;
menu_input->pointer.accel = menu_input->pointer.accel * 0.96;
}

View File

@ -1410,7 +1410,6 @@ static void xmb_render(void)
menu_handle_t *menu = menu_driver_get_ptr();
menu_display_t *disp = menu_display_get_ptr();
menu_animation_t *anim = menu_animation_get_ptr();
menu_input_t *menu_input = menu_input_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
@ -1441,13 +1440,13 @@ static void xmb_render(void)
if (settings->menu.pointer.enable)
{
if (pointer_y > item_y1 && pointer_y < item_y2)
menu_input->pointer.ptr = i;
menu_input_ctl(MENU_CTL_POINTER_PTR, &i);
}
if (settings->menu.mouse.enable)
{
if (mouse_y > item_y1 && mouse_y < item_y2)
menu_input->mouse.ptr = i;
menu_input_ctl(MENU_CTL_MOUSE_PTR, &i);
}
}
}

View File

@ -87,6 +87,12 @@ bool menu_input_ctl(enum menu_ctl_state state, void *data)
menu_input->mouse.ptr = *ptr;
}
return true;
case MENU_CTL_POINTER_PTR:
{
unsigned *ptr = (unsigned*)data;
menu_input->pointer.ptr = *ptr;
}
return true;
}
return false;

View File

@ -77,7 +77,8 @@ enum menu_ctl_state
{
MENU_CTL_MOUSE_SCROLL_DOWN = 0,
MENU_CTL_MOUSE_SCROLL_UP,
MENU_CTL_MOUSE_PTR
MENU_CTL_MOUSE_PTR,
MENU_CTL_POINTER_PTR
};
enum mouse_action