controls: added adjusting game speed with - and +

This commit is contained in:
Trianta 2024-05-20 01:20:05 -05:00
parent b18ce89970
commit 22da054dab

View File

@ -134,6 +134,14 @@ namespace snakeplusplus
if ((event.type == sf::Event::Closed) if ((event.type == sf::Event::Closed)
|| (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))) || (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)))
gameWindow.close(); gameWindow.close();
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Equal)) {
if (delay > sf::milliseconds(16)) { continue; }
delay += sf::milliseconds(1);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Hyphen)) {
if (delay == sf::milliseconds(0)) { continue; }
delay -= sf::milliseconds(1);
}
} }
} }