Chodzi tobie, o często używane tzw. "Press any key to ..." . Po prostu wykryj samo wywołanie zdarzenia wciśnięcia klawisza.
if (event.type == sf::Event::KeyPressed)
{
. . .
}
GameDev Academy - How to Handle User Interactions with SFML
[ Edit ]
Oczywiście miałem na myśli
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window.close();
} else if (event.type == sf::Event::MouseButtonPressed) {
std::cout << "Mouse button pressed" << std::endl;
} else if (event.type == sf::Event::KeyPressed) {
std::cout << "Some key pressed" << std::endl;
}
}
w dokumentacji przecież masz The sf::Event type - explained
sf::Event event;
// while there are pending events...
while (window.pollEvent(event))
{
// check the type of the event...
switch (event.type)
{
// window closed
case sf::Event::Closed:
window.close();
break;
// key pressed
case sf::Event::KeyPressed: // <-- TU
...
break;
// we don't process other types of events
default:
break;
}
}