K guys so I have another question I'm sure the solution is simple, but now that I have the recreated window how do I clear it here's my code:
...
Thanks!
Clear it? Like what you did at the bottom? "window.clear(sf::Color::Black);"
Also, check this
bool isSpriteHover(sf::FloatRect sprite, sf::Vector2f mp)
{
if (sprite.contains(mp)){
return true;
}
return false;
}
This is the same as
bool isSpriteHover(sf::FloatRect sprite, sf::Vector2f mp) { return sprite.contains(mp) }
which is much better. Do you understand why that works? Thing is, sprite.contains() returns a boolean. So instead of doing if(true) {return true} else{return false} just, return the boolean that you receive. Now, there's a whole lot of things why this is better. The two most important ones: It's clearer and you don't have an "if". Getting rid of ifs is something that is great, and there's theory behind it. Basically, if you don't have an if, the computer knows what are the next instructions. If you have an 'if' statement, then you will have 2 paths, and the computer doesn't know which one to execute (at first), so it can't "see" what will come.