Hey everybody,
I'm currently working on a risk clone, and I'm having trouble with a small feature. What I currently have is a handful of sprites that make up the countries on the game map. Since sprites are rectangles and the countries are different shapes, I can't accurately tell if the mouse is hovering over a single sprite, as the transparent portions of adjacent sprites overlap with each other. To solve this, I simply added an sf::Image to my Entity class, and added a method called containsMouse() which first checks to see if the bounding box of the sprite contains the mouse, and then if the pixel at the mouse coordinate is transparent. If the pixel is transparent, the function will return false, and vice versa. My issue is that I have the functionality to run my game at different resolutions, and thus I am required to scale my sprites based on the size of the window. When I scale the sprites, the image that I load when I set the sprite's texture is a different size than the sprite itself, so when I check to see if the mouse is above a transparent pixel, it does not take into account the scale. Would anybody here happen to have a solution to this problem? Thanks.