Hello.
Currently, I am working on a program which prints a character and then waits for 100 milliseconds, after which it prints a second character.
However, I also have a... well, let's call it a "box". When the mouse clicks on this box, it changes color.
I have figured most of this out. However, I have a problem due to the wait time. This is, in mostly psuedo-code, what's giving me trouble.
sf::RenderWindow window;
while (!shouldStop)
{
window.clear(sf::Color::White);
window.draw(boxSprite_NotSelected);
// print characters, etc.
if (boxRectangle.Contains(GetMousePosition())
{
if (IsLeftMouseButtonPressedInRectangle())
{ shouldStop = true; window.draw(boxSprite_Selected); }
}
window.display();
sf::sleep(sf::milliseconds(100));
}
During the sleep time of 0.1 seconds, if I click on the box, it, obviously, doesn't register. What I want to know is how to fix this. Should I not use sf::sleep? What do I do?