From 22da054dab6eddb6aa85972105db8d6da6fcc08a Mon Sep 17 00:00:00 2001 From: Trianta <56975502+Trimutex@users.noreply.github.com> Date: Mon, 20 May 2024 01:20:05 -0500 Subject: [PATCH] controls: added adjusting game speed with - and + --- src/playerinterface.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/playerinterface.cpp b/src/playerinterface.cpp index ff5c26a..fe4a5f4 100755 --- a/src/playerinterface.cpp +++ b/src/playerinterface.cpp @@ -134,6 +134,14 @@ namespace snakeplusplus if ((event.type == sf::Event::Closed) || (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))) 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); + } } }