[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Written by Michael Voase, mvoase@midcoast.com.au.
To begin this section, I am assuming here that you are aware of how to obtain the various interfaces from the engine. If not, read the documentation for SCF, the Shared Class Facility. See section 6.3 Shared Class Facility (SCF). I will be using terminology and concepts which are explained in that section. If you are only interested in writing map files for the engine then you can skip ahead to the next section.
Secondly, I am also presuming that you have loaded your sprite into the engine, and have access to that sprite via the `iEngine' interface. That implies that you have written a basic Crystal Space application (or are hacking up an existing application), and can access your sprite mesh factory using calls similar to the following:
iMeshFactoryWrapper *fwrap = Engine->FindMeshFactory("name"); iMeshObjectFactory *fact = fwrap->GetMeshObjectFactory(); iMeshWrapper *mwrap = Engine->FindMeshObject("name"); iMeshObject *mesh = mwrap->GetMeshObject(); |
With the name being the name of your mesh factory or object, respectively. There are four main interfaces that we will be dealing with in this section,
iSpriteFrame
iSpriteAction
iSprite3DFactoryState
iSprite3DState
.
The declarations for these interfaces can be found in
`CS/include/imesh/sprite3d.h'. The first two interfaces can be obtained
by using the FindFrame()
and FindAction()
methods in the
`iSprite3dFactoryState' interface (described later).
The third interface can be obtained by querying the `iMeshObjectFactory'
interface. The `iSprite3DState' interface can be obtained from the
`iMeshObject' interface. The following is a summary of the methods in
each interface and what they do. An example of obtaining the state interfaces
is described below:
csRef<iSprite3dFactoryState> fstat = SCF_QUERY_INTERFACE(fact, iSprite3dFactoryState); csRef<iSprite3DState> stat = SCF_QUERY_INTERFACE(mesh, iSprite3DState); |
The `mesh' and `fact' variables are the ones mentioned earlier in this chapter. The following is summary of the methods and interface that are useful to the sprite animator during production. This summary does not fully document the `iSprite3DState' or `iSprite3DFactoryState' interfaces since they are adequately documented elsewhere. Only methods which are relevant to frame animation are treated here.
iSpriteFrame
Current version: 0.0.2
void SetName(char const*)
char const* GetName()
int GetAnmIndex()
int GetTexIndex()
iSpriteAction
Current version: 0.0.1
void SetName(char const*)
char const* GetName() const
int GetFrameCount()
iSpriteFrame* GetFrame(int)
iSpriteFrame* GetNextFrame()
int GetFrameDelay(int)
void AddFrame(iSpriteFrame* frame, int time)
iSprite3DFactoryState
Current version: 0.0.2
void AddVertices(int number)
iSpriteFrame* AddFrame()
iSpriteFrame* FindFrame(const char* title)
int GetFrameCount()
iSpriteFrame* GetFrame(int index) const
iSpriteAction* AddAction()
iSpriteAction* FindAction(const char* title) const
iSpriteAction* GetFirstAction() const
int GetActionCount() const
iSpriteAction* GetAction(int index) const
void EnableTweening(bool flag)
bool IsTweeningEnabled()
iSprite3DState
Current version: 0.0.4
void SetFrame(int index)
int GetCurFrame() const
int GetFrameCount() const
bool SetAction(const char *title)
iSpriteAction* GetCurAction() const
EnableTweening(bool flag)
bool IsTweeningEnabled() const
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |