mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-20 18:02:12 +00:00
Preliminary changes for the utf8 OSK
This commit is contained in:
parent
21c7f562f7
commit
97e13c4409
@ -166,6 +166,32 @@ static bool input_keyboard_line_event(
|
||||
return false;
|
||||
}
|
||||
|
||||
bool input_keyboard_line_append(char* word)
|
||||
{
|
||||
char *newbuf = (char*)
|
||||
realloc(g_keyboard_line->buffer, g_keyboard_line->size + 2);
|
||||
if (!newbuf)
|
||||
return false;
|
||||
|
||||
memmove(newbuf + g_keyboard_line->ptr + 1,
|
||||
newbuf + g_keyboard_line->ptr,
|
||||
g_keyboard_line->size - g_keyboard_line->ptr + 1);
|
||||
|
||||
unsigned i = 0;
|
||||
for (i = 0; i < strlen(word); i++)
|
||||
{
|
||||
newbuf[g_keyboard_line->ptr] = word[i];
|
||||
g_keyboard_line->ptr++;
|
||||
g_keyboard_line->size++;
|
||||
}
|
||||
|
||||
newbuf[g_keyboard_line->size] = '\0';
|
||||
|
||||
g_keyboard_line->buffer = newbuf;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* input_keyboard_start_line:
|
||||
* @userdata : Userdata.
|
||||
|
@ -77,6 +77,8 @@ typedef struct input_keyboard_ctx_wait
|
||||
void input_keyboard_event(bool down, unsigned code, uint32_t character,
|
||||
uint16_t mod, unsigned device);
|
||||
|
||||
bool input_keyboard_line_append(char* word);
|
||||
|
||||
/**
|
||||
* input_keyboard_start_line:
|
||||
* @userdata : Userdata.
|
||||
|
@ -271,7 +271,7 @@ static void mui_draw_text(font_data_t *font, float x, float y, unsigned width, u
|
||||
menu_display_draw_text(font, msg, width, height, ¶ms);
|
||||
}
|
||||
|
||||
static void mui_render_keyboard(mui_handle_t *mui, char* grid, unsigned id)
|
||||
static void mui_render_keyboard(mui_handle_t *mui, char* grid[], unsigned id)
|
||||
{
|
||||
unsigned i, width, height;
|
||||
float dark[16]= {
|
||||
@ -297,10 +297,6 @@ static void mui_render_keyboard(mui_handle_t *mui, char* grid, unsigned id)
|
||||
for (i = 0; i <= 40; i++)
|
||||
{
|
||||
int line_y;
|
||||
char letter[2];
|
||||
|
||||
letter[0] = grid[i];
|
||||
letter[1] = '\0';
|
||||
line_y = (i / 10)*height/10.0;
|
||||
|
||||
if (i == id)
|
||||
@ -314,7 +310,7 @@ static void mui_render_keyboard(mui_handle_t *mui, char* grid, unsigned id)
|
||||
mui_draw_text(mui->font,
|
||||
width/11.0 + (i % 10) * width/11.0,
|
||||
height*2.5/4.0 + line_y,
|
||||
width, height, letter, 0xffffffff, TEXT_ALIGN_CENTER);
|
||||
width, height, grid[i], 0xffffffff, TEXT_ALIGN_CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -686,7 +686,7 @@ static void xmb_messagebox(void *data, const char *message)
|
||||
strlcpy(xmb->box_message, message, sizeof(xmb->box_message));
|
||||
}
|
||||
|
||||
static void xmb_render_keyboard(xmb_handle_t *xmb, char* grid, unsigned id)
|
||||
static void xmb_render_keyboard(xmb_handle_t *xmb, char* grid[], unsigned id)
|
||||
{
|
||||
unsigned i, width, height;
|
||||
float dark[16]= {
|
||||
@ -712,10 +712,6 @@ static void xmb_render_keyboard(xmb_handle_t *xmb, char* grid, unsigned id)
|
||||
for (i = 0; i <= 40; i++)
|
||||
{
|
||||
int line_y;
|
||||
char letter[2];
|
||||
|
||||
letter[0] = grid[i];
|
||||
letter[1] = '\0';
|
||||
line_y = (i / 10)*height/10.0;
|
||||
|
||||
if (i == id)
|
||||
@ -726,7 +722,7 @@ static void xmb_render_keyboard(xmb_handle_t *xmb, char* grid, unsigned id)
|
||||
width, height,
|
||||
&light[0]);
|
||||
|
||||
xmb_draw_text(xmb, letter,
|
||||
xmb_draw_text(xmb, grid[i],
|
||||
width/11.0 + (i % 10) * width/11.0,
|
||||
height*2.5/4.0 + line_y,
|
||||
1, 1, TEXT_ALIGN_CENTER, width, height, xmb->font);
|
||||
|
@ -162,9 +162,15 @@ unsigned menu_event(uint64_t input, uint64_t trigger_input)
|
||||
if (menu_input_dialog_get_display_kb())
|
||||
{
|
||||
if (kbd_upper)
|
||||
strlcpy(kbd_grid, "!@#$%^&*()QWERTYUIOPASDFGHJKL:ZXCVBNM <>?", sizeof(kbd_grid));
|
||||
{
|
||||
char* grid[] = {"!","@","#","$","%","^","&","*","(",")","Q","W","E","R","T","Y","U","I","O","P","A","S","D","F","G","H","J","K","L",":","Z","X","C","V","B","N","M"," ","<",">","?"};
|
||||
memcpy(kbd_grid, grid, sizeof(grid));
|
||||
}
|
||||
else
|
||||
strlcpy(kbd_grid, "1234567890qwertyuiopasdfghjkl:zxcvbnm ,./", sizeof(kbd_grid));
|
||||
{
|
||||
char* grid[] = {"1","2","3","4","5","6","7","8","9","0","あ","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l",";","z","x","c","v","b","n","m"," ",",",".","/"};
|
||||
memcpy(kbd_grid, grid, sizeof(grid));
|
||||
}
|
||||
|
||||
if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_DOWN))
|
||||
{
|
||||
@ -197,8 +203,7 @@ unsigned menu_event(uint64_t input, uint64_t trigger_input)
|
||||
|
||||
if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_A))
|
||||
{
|
||||
input_keyboard_event(true, kbd_grid[kbd_index], kbd_grid[kbd_index],
|
||||
0, RETRO_DEVICE_KEYBOARD);
|
||||
input_keyboard_line_append(kbd_grid[kbd_index]);
|
||||
}
|
||||
|
||||
if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_B))
|
||||
|
@ -40,7 +40,7 @@ void menu_event_keyboard_set(bool down, enum retro_key key);
|
||||
unsigned char menu_event_keyboard_is_set(enum retro_key key);
|
||||
|
||||
unsigned kbd_index;
|
||||
char kbd_grid[41];
|
||||
char* kbd_grid[41];
|
||||
bool kbd_upper;
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
Loading…
x
Reference in New Issue
Block a user