Create menu_display_osk_ptr_at_pos

This commit is contained in:
twinaphex 2018-04-23 11:58:18 +02:00
parent 8bc3283bd5
commit bac0d22ce9
4 changed files with 39 additions and 66 deletions

View File

@ -407,37 +407,6 @@ static void materialui_draw_tab(
&tab_color[0]);
}
/* Returns the OSK key at a given position */
static int materialui_osk_ptr_at_pos(void *data, int x, int y,
unsigned width, unsigned height)
{
unsigned i;
int ptr_width, ptr_height;
materialui_handle_t *mui = (materialui_handle_t*)data;
if (!mui)
return -1;
ptr_width = width / 11;
ptr_height = height / 10;
if (ptr_width >= ptr_height)
ptr_width = ptr_height;
for (i = 0; i < 44; i++)
{
int line_y = (i / 11)*height/10.0;
int ptr_x = width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width;
int ptr_y = height/2.0 + ptr_height*1.5 + line_y - ptr_height;
if (x > ptr_x && x < ptr_x + ptr_width
&& y > ptr_y && y < ptr_y + ptr_height)
return i;
}
return -1;
}
/* Draw the tabs background */
static void materialui_draw_tab_begin(
materialui_handle_t *mui,
@ -2813,7 +2782,7 @@ menu_ctx_driver_t menu_ctx_mui = {
NULL,
NULL,
NULL,
materialui_osk_ptr_at_pos,
menu_display_osk_ptr_at_pos,
NULL,
NULL,
materialui_pointer_down,

View File

@ -800,36 +800,6 @@ static void xmb_messagebox(void *data, const char *message)
xmb->box_message = strdup(message);
}
/* Returns the OSK key at a given position */
static int xmb_osk_ptr_at_pos(void *data, int x, int y, unsigned width, unsigned height)
{
unsigned i;
int ptr_width, ptr_height;
xmb_handle_t *xmb = (xmb_handle_t*)data;
if (!xmb)
return -1;
ptr_width = width / 11;
ptr_height = height / 10;
if (ptr_width >= ptr_height)
ptr_width = ptr_height;
for (i = 0; i < 44; i++)
{
int line_y = (i / 11)*height/10.0;
int ptr_x = width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width;
int ptr_y = height/2.0 + ptr_height*1.5 + line_y - ptr_height;
if (x > ptr_x && x < ptr_x + ptr_width
&& y > ptr_y && y < ptr_y + ptr_height)
return i;
}
return -1;
}
static void xmb_render_messagebox_internal(
video_frame_info_t *video_info,
xmb_handle_t *xmb, const char *message, float* coord_white)
@ -5139,7 +5109,7 @@ menu_ctx_driver_t menu_ctx_xmb = {
xmb_update_thumbnail_image,
xmb_set_thumbnail_system,
xmb_set_thumbnail_content,
xmb_osk_ptr_at_pos,
menu_display_osk_ptr_at_pos,
xmb_update_savestate_thumbnail_path,
xmb_update_savestate_thumbnail_image
};

View File

@ -196,6 +196,31 @@ static unsigned scroll_index_size = 0;
static unsigned scroll_acceleration = 0;
static size_t menu_driver_selection_ptr = 0;
/* Returns the OSK key at a given position */
int menu_display_osk_ptr_at_pos(void *data, int x, int y,
unsigned width, unsigned height)
{
unsigned i;
int ptr_width = width / 11;
int ptr_height = height / 10;
if (ptr_width >= ptr_height)
ptr_width = ptr_height;
for (i = 0; i < 44; i++)
{
int line_y = (i / 11)*height/10.0;
int ptr_x = width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width;
int ptr_y = height/2.0 + ptr_height*1.5 + line_y - ptr_height;
if (x > ptr_x && x < ptr_x + ptr_width
&& y > ptr_y && y < ptr_y + ptr_height)
return i;
}
return -1;
}
enum menu_toggle_reason menu_display_toggle_get_reason(void)
{
return menu_display_toggle_reason;

View File

@ -745,11 +745,20 @@ void menu_display_draw_text(
#define menu_display_set_alpha(color, alpha_value) (color[3] = color[7] = color[11] = color[15] = (alpha_value))
font_data_t *menu_display_font(enum application_special_type type, float font_size,
font_data_t *menu_display_font(
enum application_special_type type,
float font_size,
bool video_is_threaded);
void menu_display_reset_textures_list(const char *texture_path, const char *iconpath,
uintptr_t *item, enum texture_filter_type filter_type);
void menu_display_reset_textures_list(
const char *texture_path,
const char *iconpath,
uintptr_t *item,
enum texture_filter_type filter_type);
/* Returns the OSK key at a given position */
int menu_display_osk_ptr_at_pos(void *data, int x, int y,
unsigned width, unsigned height);
void menu_driver_destroy(void);