I have a friend who's interested in switching from a BASIC variant to BM for a project. However he has a single image with multiple "frames" each containing an art asset to cut down on loading times. He want to know if he could load these from a file and use them. The problem arises is that these images are not the same size.
Unique frame sizes
BlitzMax Forums/BlitzMax Programming/Unique frame sizes You can't do it in the conventional way with LoadAnimImage() but there's nothing to stop you using an array or list of TImages to achieve the same effect.
Right, but he's concerned about loading time.
Any of the above methods will execute in pretty much the same [small] amount of time.
You can use PixmapWindow(), something like this.
'Image1 is located at coordinates 0,0 and is 128x96 'Image2 is located at 128,0 and is 32x32 local TempPixmap:TPixmap = LoadPixmap("File.png") 'Load the file Local Image1:TImage = LoadImage(PixmapWindow(TempPixmap,0,0,128,64)) 'extract the first image Local Image2:TImage = LoadImage(PixmapWindow(TempPixmap,128,0,32,32)) 'extract the second image TempPixmap = Null 'Not needed anymore ...Comtinue with the rest of program
One technique some people use is they choose a specific color which does not appear/is not used anywhere in their graphics - like a bright green or bright pink. Then they put all of their various images onto a sprite sheet type of thing and draw boxes around them in the chosen color. Then you load the pixmap in BlitzMax and write a small routine which basically looks at each pixel and `finds` the bounding rectangles and then extracts the frames from it (using pixmap window for example).
Another way is to just put all your images on a sprite sheet pixmap, load it, turn the entire thing into an image, and then make some graphics code to render only part of the image.
Another way is to just put all your images on a sprite sheet pixmap, load it, turn the entire thing into an image, and then make some graphics code to render only part of the image.