From 72d87c0d2a17b220c40faa067fac70b7193a6573 Mon Sep 17 00:00:00 2001 From: Romain Graillot Date: Thu, 11 Apr 2019 19:47:49 +0200 Subject: [PATCH] Fix virtual keyboard input and visual glitches --- src/readline.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/readline.c b/src/readline.c index 9e29faec..bc9da8fb 100644 --- a/src/readline.c +++ b/src/readline.c @@ -784,10 +784,6 @@ byte Readline_ex_unicode(word x_pos, word y_pos, char * str, word * str_unicode, #endif Hide_cursor(); - // Effacement de la chaîne - Window_rectangle(x_pos,y_pos,visible_size<<3,8,BACKGROUND_COLOR); - Update_window_area(x_pos,y_pos,visible_size<<3,8); - // Mise à jour des variables se rapportant à la chaîne en fonction de la chaîne initiale strcpy(initial_string,str); if (str_unicode != NULL) @@ -824,7 +820,9 @@ byte Readline_ex_unicode(word x_pos, word y_pos, char * str, word * str_unicode, Display_whole_string(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),display_string,position - offset); } - Update_window_area(x_pos,y_pos,visible_size<<3,8); + Update_rect(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y), + visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3)); + Flush_update(); if (Mouse_K) { @@ -842,6 +840,7 @@ byte Readline_ex_unicode(word x_pos, word y_pos, char * str, word * str_unicode, clicked_button=Window_clicked_button(); input_char=0; + input_key = Key; if (clicked_button==-1) input_key=KEY_RETURN; @@ -1043,7 +1042,8 @@ byte Readline_ex_unicode(word x_pos, word y_pos, char * str, word * str_unicode, size--; // Effacement de la chaîne - Window_rectangle(x_pos,y_pos,visible_size<<3,8,BACKGROUND_COLOR); + Screen_FillRect((window_x+(x_pos*Menu_factor_X))*Pixel_width, (window_y+(y_pos*Menu_factor_Y))*Pixel_height, + (visible_size*(Menu_factor_X<<3))*Pixel_width, (Menu_factor_Y<<3)*Pixel_height, BACKGROUND_COLOR); goto affichage; } break; @@ -1052,8 +1052,8 @@ byte Readline_ex_unicode(word x_pos, word y_pos, char * str, word * str_unicode, { // Effacement de la chaîne if (position==size) - Window_rectangle(x_pos,y_pos,visible_size<<3,8,BACKGROUND_COLOR); - position--; + Screen_FillRect((window_x+(x_pos*Menu_factor_X))*Pixel_width, (window_y+(y_pos*Menu_factor_Y))*Pixel_height, + (visible_size*(Menu_factor_X<<3))*Pixel_width, (Menu_factor_Y<<3)*Pixel_height, BACKGROUND_COLOR); position--; if (offset > 0 && (position == 0 || position < (offset + 1))) offset--; goto affichage; @@ -1083,8 +1083,8 @@ byte Readline_ex_unicode(word x_pos, word y_pos, char * str, word * str_unicode, { // Effacement de la chaîne if (position==size) - Window_rectangle(x_pos,y_pos,visible_size<<3,8,BACKGROUND_COLOR); - position = 0; + Screen_FillRect((window_x+(x_pos*Menu_factor_X))*Pixel_width, (window_y+(y_pos*Menu_factor_Y))*Pixel_height, + (visible_size*(Menu_factor_X<<3))*Pixel_width, (Menu_factor_Y<<3)*Pixel_height, BACKGROUND_COLOR); position = 0; offset = 0; goto affichage; } @@ -1111,8 +1111,8 @@ byte Readline_ex_unicode(word x_pos, word y_pos, char * str, word * str_unicode, Remove_character(str,position); size--; // Effacement de la chaîne - Window_rectangle(x_pos,y_pos,visible_size<<3,8,BACKGROUND_COLOR); - goto affichage; + Screen_FillRect((window_x+(x_pos*Menu_factor_X))*Pixel_width, (window_y+(y_pos*Menu_factor_Y))*Pixel_height, + (visible_size*(Menu_factor_X<<3))*Pixel_width, (Menu_factor_Y<<3)*Pixel_height, BACKGROUND_COLOR); goto affichage; } break; case KEY_CLEAR : // Clear @@ -1121,8 +1121,8 @@ byte Readline_ex_unicode(word x_pos, word y_pos, char * str, word * str_unicode, str_unicode[0] = 0; position=offset=0; // Effacement de la chaîne - Window_rectangle(x_pos,y_pos,visible_size<<3,8,BACKGROUND_COLOR); - goto affichage; + Screen_FillRect((window_x+(x_pos*Menu_factor_X))*Pixel_width, (window_y+(y_pos*Menu_factor_Y))*Pixel_height, + (visible_size*(Menu_factor_X<<3))*Pixel_width, (Menu_factor_Y<<3)*Pixel_height, BACKGROUND_COLOR); goto affichage; case KEY_RETURN : break; @@ -1138,7 +1138,6 @@ byte Readline_ex_unicode(word x_pos, word y_pos, char * str, word * str_unicode, } break; default : -#if !defined(USE_SDL2) if (size