SFML community forums
Help => Graphics => Topic started by: Flaze07 on July 09, 2017, 05:49:18 am
-
hi...I think I have asked more than 2 question in this forum since yesterday...
anyways...
I want to have it so my mouse button received input is not received when it is pressed continuously
I know you can do it with event...but the code where the mouse input received is in another file
so I tried this code...
while (1)
{
if ( (sf::Mouse::isButtonPressed(sf::Mouse::Left)) && (!pressed) )
{
std::cout << "haha" << i++ << " " << pressed << std::endl;
pressed = true;
std::cout << pressed;
continue;
}
pressed = false;
}
even If I pressed the left mouse button...it didn't continue..I wonder why
-
nvm I see the problem...
-
just found a fix :D :D ;D
while (1)
{
if ((sf::Mouse::isButtonPressed(sf::Mouse::Left)))
{
if (pressed) continue;
else
{
std::cout << "haha" << i++ << " " << pressed << std::endl;
pressed = true;
std::cout << pressed;
}
continue;
}
pressed = false;
}
funny how I realized it after looking at my own thread