@@ -847,7 +847,7 @@ eMenu Menu::SDLMain_Level()
847847 Sprites[title].Draw (400 , 65 , 0 , Sprites[fmenu].Image [0 ]);
848848
849849 AddTextButton (0 , " New game" , 400 , 225 , m_screen);
850- AddTextButton (1 , " Old level" , 400 , 340 , m_screen);
850+ AddTextButton (1 , " Old level" , 400 , 305 , m_screen);
851851 AddTextButton (2 , " Menu" , 400 , 445 , m_screen);
852852
853853 AddButton (3 , arrows, 330 , 380 );
@@ -966,7 +966,7 @@ eMenu Menu::SDLMain_Level()
966966 m_screen.PrintSprite (arrows, 3 , 470 , 380 );
967967 }
968968
969- m_screen.PrintText (std::to_string (Level + 1 ), 400 , 380 );
969+ m_screen.PrintText (std::to_string (Level + 1 ), 390 , 355 );
970970
971971 if (PyE != 3 && PyE != 4 ) {
972972 Print_Main ();
@@ -1218,7 +1218,7 @@ void Menu::Print_InGame()
12181218
12191219 AddTextButton (0 , " Continue" , 340 , 185 , m_screen);
12201220 AddTextButton (1 , " Settings" , 340 , 300 , m_screen);
1221- AddTextButton (2 , " Exit from game " , 340 , 415 , m_screen);
1221+ AddTextButton (2 , " Exit" , 340 , 415 , m_screen);
12221222 Menu_Py[3 ].StartX = -1 ;
12231223}
12241224
@@ -1367,11 +1367,11 @@ eMenu Menu::SDLMain_Score(bool EditScore)
13671367
13681368 // Draw title and commands
13691369 m_screen.ChangeFontColor (255 , 255 , 0 );
1370- m_screen.PrintText (" Better score " , 400 - m_screen.TextLength (" Better score " ) / 2 , 50 );
1370+ m_screen.PrintText (" Better scores " , 400 - m_screen.TextLength (" Better scores " ) / 2 , 50 );
13711371#ifndef ANDROID
1372- m_screen.PrintText (" Press any key" , 400 - m_screen.TextLength (" Press any key" ) / 2 , 550 );
1372+ m_screen.PrintText (" Press any key" , 400 - m_screen.TextLength (" Press any key" ) / 2 , 540 );
13731373#else
1374- m_screen.PrintText (" Tap to continue" , 400 - m_screen.TextLength (" Tap to continue" ) / 2 , 550 );
1374+ m_screen.PrintText (" Tap to continue" , 400 - m_screen.TextLength (" Tap to continue" ) / 2 , 540 );
13751375#endif
13761376 m_screen.ChangeFontColor (255 , 255 , 255 );
13771377
@@ -1390,7 +1390,7 @@ eMenu Menu::SDLMain_Score(bool EditScore)
13901390 }
13911391
13921392 sprintf (Provi, " %i" , Pref.Sco [i].Score );
1393- m_screen.PrintText (Provi, 740 - m_screen.TextLength (std::string (Provi)), 120 + i * (360 / 7 ));
1393+ m_screen.PrintText (Provi, 720 - m_screen.TextLength (std::string (Provi)), 120 + i * (360 / 7 ));
13941394 }
13951395
13961396 // Erase background
@@ -1408,7 +1408,13 @@ eMenu Menu::SDLMain_Score(bool EditScore)
14081408 case SDL_KEYDOWN: // Waits a Keyboard press
14091409 if (event.key .state == SDL_PRESSED) {
14101410 if (NEdit >= 0 && event.key .keysym .sym == SDLK_BACKSPACE && !Pref.Sco [NEdit].Name .empty ()) {
1411- Pref.Sco [NEdit].Name .pop_back ();
1411+ std::string ¤tScore = Pref.Sco [NEdit].Name ;
1412+ // For utf-8 characters, we need to pop_back twice
1413+ // Use SDL_StepBackUTF8 with sdl3 to detect utf-8 characters?
1414+ if ((currentScore[currentScore.size () - 1 ] & 0xc0 ) == 0x80 ) {
1415+ currentScore.pop_back ();
1416+ }
1417+ currentScore.pop_back ();
14121418 }
14131419 m_audio.Play (sClick );
14141420 if (EditScore == false && event.key .keysym .sym != SDLK_F12) {
@@ -1433,7 +1439,7 @@ eMenu Menu::SDLMain_Score(bool EditScore)
14331439 }
14341440 break ;
14351441 case SDL_TEXTINPUT:
1436- if (NEdit >= 0 ) {
1442+ if (NEdit >= 0 && Pref. Sco [NEdit]. Name . size () <= 16 ) {
14371443 Pref.Sco [NEdit].Name += event.text .text ;
14381444 }
14391445 break ;
@@ -1456,10 +1462,9 @@ eMenu Menu::SDLMain_Score(bool EditScore)
14561462 }
14571463
14581464 i = (currentTime / 50 ) % 20 ; // Draw cursors
1459- m_screen.PrintSprite (arrow_left, i, 110 , 120 + NEdit * (360 / 7 ));
1460-
14611465 int textLen = Pref.Sco [NEdit].Name .empty () ? 0 : m_screen.TextLength (Pref.Sco [NEdit].Name );
1462- m_screen.PrintSprite (arrow_right, i, 180 + textLen, 120 + NEdit * (360 / 7 ));
1466+ m_screen.PrintSprite (arrow_left, i, 110 , 150 + NEdit * (360 / 7 ));
1467+ m_screen.PrintSprite (arrow_right, i, 180 + textLen, 150 + NEdit * (360 / 7 ));
14631468 }
14641469
14651470 // Update render
0 commit comments