Please make use of the code=cpp tag!
This will work, but will throw you a warning at you up on compiling.
sf::FloatRect rectBounds = enemy.getGlobalBounds();
if (mouseX == rectBounds.left && mouseY == rectBounds.top)
{
hoverEnemy = true;
}
This won't throw a warning:
sf::FloatRect rectBounds = enemy.getGlobalBounds();
if (mouseX == static_cast<int>(rectBounds.left) && mouseY == static_cast<int>(rectBounds.top))
{
hoverEnemy = true;
}
But the coordinates won't get rounded up, so you could use:
sf::FloatRect rectBounds = enemy.getGlobalBounds();
if (mouseX == static_cast<int>(rectBounds.left+0.5f) && mouseY == static_cast<int>(rectBounds.top+0.5f))
{
hoverEnemy = true;
}
Then again this all seems a bit wrong and since you probably want some sort of collision test you'd better check if the mouse cursor is inside the rectangle:
if (enemy.getGlobalBounds().contains(static_cast<sf::Vector2f>(sf::Mouse::getPosition(window))))
{
hoverEnemy = true;
}