SFML community forums
Help => Graphics => Topic started by: Austech on February 01, 2010, 09:52:19 am
-
Is there a mathematical way to scale a sprite to fit a whole window? I tried scaling it like:
Scale(WindowWidth - ImageWidth,WindowHeight - ImageHeight);
But It seems to scale way too big. So is there a way to do it?
Once again thanks in advanced.
-
The scale is a factor that it multiplied to the original size, not added. So you should call
sprite.Scale(WindowWidth / ImageWidth, WindowHeight / ImageHeight);
Or simply use Resize, which does this job for you
sprite.Resize(WindowWidth, WindowHeight);
-
Thanks, the resize function worked perfectly. :)