SpriteMaster Pro

Getting Started


The best way to understand how to use spriteMaster Pro 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 SpriteMaster Pro include file. The name of this file is smPro.bb

Include "smPro.bb"

Now, you initialse the display with:

SpriteGraphics width,height

Once the display is set up you can go ahead and create / load your sprites. SpriteMaster Pro can deal with several types of sprites:

CreateSprite() Create a blank separate-surface sprite
LoadSprite() Load and create a separate-surface sprite
GetPackedSprite() Get a sprite from a loaded pack
CreateTextSprite() Create a text sprite from a font set

Each of the above functions will return a pointer to a .smSprite type (used by SpriteMaster Pro). See SpriteMaster Pro - Type Structure
Your variable which handles the sprite needs to be a
.smSprite type. This example shows CreateSprite() in action:

blanksprite.smSprite=CreateSprite(64,20)
PositionSprite blanksprite,50,60

Refer to commands and functions for more information.


Now you have your sprites created/loaded you can position, resize, rotate , re-color, change alpha etc... Check the commands under:

Sprite - Display and animation in commands and functions.


The final part is to use Blitz3D's RenderWorld / Flip to show the sprites.
Here is a simple working example:

; SpriteMasterPro - Basic example

Include "smPro.bb"

SpriteGraphics 230,240,0,2 ; set up sprite display
pack1=LoadPack("testpack.png") ; load pack
sprite.smSprite=GetPackedSprite("sun",pack1) ; extract sprite
PositionSprite sprite,50,60 ; position sprite

RenderWorld : Flip : WaitKey

FreePack pack1 ; free up pack and extracted sprite
EndSpriteGraphics ; close down sprite display
End

Before you go there are a couple of functions to keep things clean in SpriteMaster Pro:

FreePack Free up a loaded pack and any sprites which are using the pack
FreeSprite Free up an individual sprite
EndSpriteGraphics Free up all sprites, textures, meshes, types used by SpriteMaster Pro etc ...

Main Page