bool isInsideSprite(Sprite sprite, Vector2f point) { FloatRect bounds = sprite.getGlobalBounds(); return bounds.contains(point); }
void resizeSprite(Sprite& sprite, RenderWindow& window) { FloatRect bounds = sprite.getGlobalBounds(); float scaleX = window.getSize().x / bounds.width; float scaleY = window.getSize().y / bounds.height; sprite.setScale(scaleX, scaleY); }This function takes a sprite and a window as input and resizes the sprite to fit the window. The getGlobalBounds() function is used to get the boundaries of the sprite and calculate the scaleX and scaleY to resize the sprite. Package Library: SFML Library.