Hello,
I'm trying to make a sort of button effect thingy. With 3 states; no-effect, hover-over and while pressing down. But I don't know how to get the third effect working properly.
Here is what I've got so far:
const sf::Input& Input = screen.GetInput();
if(Input.GetMouseX() > 300 && Input.GetMouseX() < 550 && // 300 550
Input.GetMouseY() > 300 && Input.GetMouseY() < 330 ) // 300 // 330
{
//hover over effect :D
buttonSprite.SetSubRect(sf::IntRect(0, 30, 250, 30));
if(Input.IsMouseButtonDown(sf::Mouse::Left))
{
//while clickingdown subrect effect
buttonSprite.SetSubRect(sf::IntRect(0, 0, 250, 30));
// now there must be away that first clicking down on the button and then up to exit.
// but I cant figure it out, help plox:D
screen.Close();
}
}
else
{
//pak een stukje van de knop geen effecten
buttonSprite.SetSubRect(sf::IntRect(0, 0, 250, 30));
}
Maybe instead of the 2nd if-loop a while-loop, but then I couldn't end the while loop, because it didn't check for input anymore..
Help plz:D