[Newbies] Changing the extent of an ImageMorph

Jan Teske jan.teske at student.hpi.uni-potsdam.de
Wed Jan 4 15:44:31 UTC 2012


Hey,

I'm currently developing a small game with Squeak. Part of it is a bunch 
of menus which should have background images. Therefore I have realized 
them as ImageMorphs with the respective images.
Now, there are menus which sizes are determined dynamically during the 
runtime of the game. That means I have to change the size of the menus. 
Since I cannot do this by manipulating 'menu extent: ...' directly, the 
only way I found until now is to manipulate the image form 'menu image: 
menu image scaledToSize: ...'. That works pretty well except for one 
thing: I cannot change the aspect ration of the original image with 
scaledToSize:. Since I do not know the extends of my menus before the 
game starts, I cannot say anything about the needed image ratio. Since 
my menus should be as applicable as possible I need to be able to resize 
also in a way which destroys the original scales.

Is there any easy workaround for my problem or a recommended way for 
creating resizable Morphs with background images?

Thanks in advance!


More information about the Beginners mailing list