[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Written by Jorrit Tyberghein, (jorrit.tyberghein@uz.kuleuven.ac.be).
A 2D Sprite is basically a polygon that always faces the camera. There are some special effects that you can do with this but it is really very simple otherwise.
The following SCF class names are used (for CS_LOAD_PLUGIN()
):
Objects in this plugin implement the following SCF interfaces (get with
SCF_QUERY_INTERFACE()
):
`iSprite2DFactoryState' is the SCF interface that you can use to set/get settings for a 2D sprite factory. The definition of this interface can be found in `CS/include/imspr2d.h' and that is also the include file you need to include in your applications to use this plugin. Using this interface you can access the material, blending mode (mixmode), and lighting settings.
LIGHTING
MATERIAL
MIXMODE
UVANIMATION
FRAME
`iSprite2DState' is the SCF interface that you can use to set/get settings for a 2D sprite object. The definition of this interface can be found in `CS/include/imspr2d.h' and that is also the include file you need to include in your applications to use this plugin. Using this interface you can access the material, blending mode (mixmode), lighting settings, and also the vertices of the 2D polygon controlled by this plugin.
FACTORY
MIXMODE
MATERIAL
LIGHTING
VERTICES
UV
COLORS
ANIMATE
This is how our world file looks:
WORLD ( TEXTURES ( TEXTURE 'blow' (FILE(blow.png)) ) MATERIALS ( MATERIAL 'explosion' (TEXTURE ('blow')) ) MESHOBJ 'Explosion' ( PLUGIN ('crystalspace.mesh.loader.factory.sprite.2d') PARAMS ( MATERIAL ('explosion') UVANIMATION 'boom' ( FRAME 'f1' ( 100, 0, 0, 0.5, 0, 0.5, 0.5, 0, 0.5) FRAME 'f2' ( 100, 0.5, 0, 1, 0, 1, 0.5, 0.5, 0.5) FRAME 'f3' ( 100, 0, 0.5, 0.5, 0.5, 0.5, 1, 0, 1) FRAME 'f4' ( 100, 0.5, 0.5, 1, 0.5, 1, 1, 0.5, 1) ) ) ) sector 'space' ( ; define all the stuff in space ; ... ; and now one of the enemies right after we met him MESHOBJ 'kaboom' ( PLUGIN ('crystalspace.mesh.loader.sprite.2d') PARAMS ( FACTORY ('Explosion') VERTICES (-1,1,1,1,1,-1,-1,-1) UV (0,0,1,0,1,1,0,1) COLORS (1,1,1,1,1,1,1,1,1,1,1,1) LIGHTING (no) ; show the animation, use the timings attached to ; the frames, loop ANIMATE ('boom', 0, yes) ) MOVE (0,0,0) ) ) ) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |