actually i got the code from a tutorial( for a button):
void Button::HandleEvents(sf::Event *ev){
if(GetActive() == true){
//Is the Mouse above the button? if yes check if left button is down and release (also set the current animation id to the rigth value)
if(mInFocus == true){
if(sf::Mouse::isButtonPressed(sf::Mouse::Left)){
SetNextAnimationID("Anim3");
if(ev->MouseButtonReleased){
SetClicked(true);
}
}
else{
SetClicked(false);
SetNextAnimationID("Anim2");
}
}
else{
SetClicked(false);
SetNextAnimationID("Anim1");
}
}
}
that works, but when i try it like that and change mState outside of the event loop depending on the state of IsClicked() it won't work as well...
e: got it to work :) still wondering why it works for the button OO