Code:
bool MouseOver(sf::Test &Test)
{
if (App.GetInput().IsMouseButtonDown(sf::Mouse::Left)) /*Do something*/();
}
Well, you need the position of the sprite and your mouse, too. It's a simple collision detection (google for 2D Collision Detection, you'll find a lot). It's more like this:
bool isPointOverSprite(const sf::Vector2f Position, const sf::Sprite &Sprite)
{
return (Position.x < Sprite.GetPosition().x + Sprite.GetSize().x) && (Sprite.GetPosition().x < Position.x) &&
(Position.y < Sprite.GetPosition().y + Sprite.GetSize().y) && (Sprite.GetPosition().y < Position.y);
}
In your case - Position.X would be
App.GetInput().GetMouseX()
Position.Y of course
App.GetInput().GetMouseY()
With the function above you could now use it like that:
sf::Vector2f mousePosition = new sf::Vector2f(App.GetInput().GetMouseX(), App.GetInput().GetMouseY());
if (App.GetInput().IsMouseButtonDown(sf::Mouse::Left)) && isPointOverSprite (mousePosition, yourSprite)