Resize images...

BlitzPlus Forums/BlitzPlus Programming/Resize images...

arget brisingr(Posted 2007) [#1]
Is there a way I can resize all images and text to fit the window? So like when you resize the window the backgroud resizes and then all the buttons resize to the sertan percent of the background I set them to be?


Terra1(Posted 2007) [#2]
@ your signature: Silver Fire.

You could try scaling the images using a formula of the windows width and height.


arget brisingr(Posted 2007) [#3]
Will that resize it when ever the window changes size?


Terra1(Posted 2007) [#4]
Well, I'm no expert, but heres my idea.
You catch the window resize event using a Select WaitEvent or Select PeekEvent. The event id is $802.

Keep a Const value of the Base Window Width (BWW) and the Base Window Height (BWH). Then use ScaleImage for every image, with the X param as BWW/New Window Width, Y param as BWH / New Window Height.

Two extra suggestions: Have duplicates of the images, the base image that you load, and an image that you display. Whenever you scale the images, make the display image a scale of the base, so the image doesn't get too distorted.
Second: You may need to work out a formula for the images postition, as this may need to change as the window is resized.

I hope I've helped.