controls: added adjusting game speed with - and +
This commit is contained in:
parent
b18ce89970
commit
22da054dab
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user