@@ -1046,7 +1046,7 @@ char *rg_gui_file_picker(const char *title, const char *path, bool (*validator)(
10461046 return filepath ;
10471047}
10481048
1049- void rg_gui_draw_virtual_keyboard (const char * title , const char * message , const char * input_buffer ,
1049+ void rg_gui_draw_input_screen (const char * title , const char * message , const char * input_buffer ,
10501050 const rg_keyboard_layout_t * current_layout , int cursor_pos , bool partial_redraw )
10511051{
10521052 const int key_width = 28 ;
@@ -1088,8 +1088,25 @@ void rg_gui_draw_virtual_keyboard(const char *title, const char *message, const
10881088 snprintf (text_buffer , sizeof (text_buffer ), "%s%s" , input_buffer , show_cursor ? "_" : " " );
10891089 rg_gui_draw_text (keyboard_x + 5 , input_box_y + 5 , keyboard_width - 10 , text_buffer , C_BLACK , C_WHITE , 0 );
10901090
1091- // Draw keyboard container with same border style as dialog
1092- rg_gui_draw_rect (keyboard_x - 2 , keyboard_y - 2 , keyboard_width + 4 , keyboard_height + 4 , 2 , gui .style .box_border , C_NONE );
1091+ // Draw keyboard pad
1092+ rg_gui_draw_virtual_keyboard (keyboard_x , keyboard_y , current_layout , cursor_pos , true);
1093+ }
1094+
1095+ void rg_gui_draw_virtual_keyboard (int x_pos , int y_pos , const rg_keyboard_layout_t * current_layout , int cursor_pos , bool partial_redraw )
1096+ {
1097+ const int key_width = 28 ;
1098+ const int key_height = 20 ;
1099+ const int keyboard_width = current_layout -> columns * key_width ;
1100+ const int keyboard_height = current_layout -> rows * key_height ;
1101+ const int keyboard_x = get_horizontal_position (x_pos , keyboard_width );
1102+ const int keyboard_y = get_vertical_position (y_pos , keyboard_height );
1103+
1104+ if (!partial_redraw )
1105+ {
1106+ // Draw keyboard container with same border style as dialog
1107+ rg_gui_draw_rect (keyboard_x - 2 , keyboard_y - 2 , keyboard_width + 4 , keyboard_height + 4 , 2 ,
1108+ gui .style .box_border , gui .style .box_background );
1109+ }
10931110
10941111 // Draw keyboard keys
10951112 for (int row = 0 ; row < current_layout -> rows ; row ++ )
@@ -1270,7 +1287,7 @@ char *rg_gui_input_str(const char *title, const char *message, const char *defau
12701287
12711288 if (redraw )
12721289 {
1273- rg_gui_draw_virtual_keyboard (title , message , input_buffer , current_layout , cursor_pos , redraws ++ > 0 );
1290+ rg_gui_draw_input_screen (title , message , input_buffer , current_layout , cursor_pos , redraws ++ > 0 );
12741291 redraw = false;
12751292 }
12761293
@@ -1287,31 +1304,6 @@ char *rg_gui_input_str(const char *title, const char *message, const char *defau
12871304 return input_length > 0 ? strdup (input_buffer ) : NULL ;
12881305}
12891306
1290- void rg_gui_draw_keyboard (const rg_keyboard_layout_t * map , size_t cursor )
1291- {
1292- RG_ASSERT_ARG (map );
1293-
1294- int width = map -> columns * 16 + 16 ;
1295- int height = map -> rows * 16 + 16 ;
1296-
1297- int x_pos = (gui .screen_width - width ) / 2 ;
1298- int y_pos = (gui .screen_height - height );
1299-
1300- char buf [2 ] = {0 };
1301-
1302- rg_gui_draw_rect (x_pos , y_pos , width , height , 2 , gui .style .box_border , gui .style .box_background );
1303-
1304- for (size_t i = 0 ; i < map -> columns * map -> rows ; ++ i )
1305- {
1306- int x = x_pos + 8 + (i % map -> columns ) * 16 ;
1307- int y = y_pos + 8 + (i / map -> columns ) * 16 ;
1308- if (!map -> layout [i ])
1309- continue ;
1310- buf [0 ] = map -> layout [i ];
1311- rg_gui_draw_text (x + 1 , y + 1 , 14 , buf , C_BLACK , i == cursor ? C_CYAN : C_IVORY , RG_TEXT_ALIGN_CENTER );
1312- }
1313- }
1314-
13151307static rg_gui_event_t volume_update_cb (rg_gui_option_t * option , rg_gui_event_t event )
13161308{
13171309 int level = rg_audio_get_volume ();
0 commit comments