There were problems in the management of the sprite. I store the control key codes in (int keyLeft, keyRight), they can be changed. Windows system delay appears before continuous key input. If I close the while loop after the window.close () line, the sprite is constantly moving left or right after a single key press.
while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); if (sf::Event::KeyPressed) { if(event.key.code==keyLeft) ball.x-=15+platSpeed/2,0; else if(event.key.code==keyRight) ball.x+=15+platSpeed/2,0; else if(event.key.code==27) menu(window, text); } }