The best way to understand how to use ImageMaster is to play with the examples. Most of the commands are covered by an example.
What follows is a step by step guide to get you up and running.
The first thing you should to do is include the ImageMaster include file. The name of this file is ImageMaster.bb
Now, you initialse the display with:
Once the display is set up you can go ahead and load a pack.
Your next step is to extract whatever image(s) you like from the pack:
Now it's just a matter of drawing the image using DrawImage and flipping the display buffers, waiting for a key press, or whatever you wish to do. Here is a basic example:
|; ImageMaster -
Graphics 230,240,0,2 ; set up sprite display
pack1=LoadPack("testpack.png") ; load pack
image=GetPackedImage("sun",pack1) ; extract image
DrawImage image,50,60 ; draw image to buffer
Flip : WaitKey
FreePack pack1 ; free up the pack
EndGraphics ; close down display
A thing to note about
animated images ...
In SpriteMasterPro animated sprites use 1 as the first frame.
In ImageMaster the first frame in an animated image is 0.
You can find the last
frame by using PackedImageFrames()
This function will return the total number of frames in an animated image. So, the range of frames starts from 0 and ends at PackedImageFrames()-1
You might want to follow SpriteMasterPro by using 1 as the first frame and PackedImageFrames() as the last frame. Then it's just a matter of using frame-1 for the DrawImage frame parameter.
Example of using an animated image:
|; ImageMaster -
Graphics 640,480,0,2 ; set up display
It's worth pointing out that once you have extracted all the images you want from a pack you can free up the pack with a call to: