Hello, I recently started using SFML, not new to programming, though it's been a few months since I've used a lot of C++.
Trying to detect if the mouse pointer is within the bounds of a sprite, and I cannot seem to get it right. I have a custom view setup just like this
mainView.setSize(sf::Vector2f(GameSettings::width, GameSettings::height));
mainView.setCenter(sf::Vector2f(0, 0));
I have a GameObject class and such which contains a sprite, whose position is set in the constructor. In my main loop I'm updating a static reference to a sf::vector3f for the mouse position which I get with sf::Mouse::getPosition(window);
So later I attempt to determine if the mouse pointer is within the area of the sprite, but I've been having trouble getting it to detect correctly.
I am doing this
if (gameObject->GetSprite().getGlobalBounds().contains(Game::MousePosition()))
Where it gets the sprite, and Game::MousePosition() returns that mouse position from earlier.
I'd appreciate any help, thanks!