Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - romhayh

Pages: [1]
1
System / sf::Event::keyReleased dosent respond
« on: May 25, 2020, 01:20:15 pm »
hey there,

as the title says, the keyReleased doesnt respond:

extern sf::RenderWindow* window;
#define SPACE sf::Keyboard::Key::Space

void gameplay::pause()
{

        //pausing by space;
        sf::Event event;
        while (window->pollEvent(event)) {
                if (event.type == sf::Event::KeyReleased) {
                        if (event.key.code == SPACE) {
                                sf::Clock clock;
                                while (clock.getElapsedTime().asSeconds() <= 1.5f) {}
                                bool goon{ true };
                                while (goon) {
                                        while (window->pollEvent(event)) {
                                                if (event.type == sf::Event::KeyReleased) {
                                                        if (event.key.code == SPACE) {
                                                                goon = false;
                                                        }
                                                }
                                        }
                                }
                        }
                }
        }
       

}

 

Pages: [1]