You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.3 KiB
105 lines
2.3 KiB
#ifndef KANIMATION_H
|
|
#define KANIMATION_H
|
|
|
|
#include <tqcanvas.h>
|
|
#include <tqdict.h>
|
|
|
|
class TQString;
|
|
|
|
/**
|
|
* This class contains information about one frame.
|
|
*/
|
|
class KFrame
|
|
{
|
|
public:
|
|
/**
|
|
* The constructor gets:
|
|
* @param nx the position x coordinate
|
|
* @param ny the position coordinate
|
|
* @param nf the frame number
|
|
*/
|
|
KFrame( double nx, double ny, int nf );
|
|
/**
|
|
* The destructor is empty yet
|
|
*/
|
|
~KFrame();
|
|
|
|
double x, y; // position
|
|
int f; // frame number
|
|
};
|
|
|
|
/**
|
|
* This class handles a list of frames, called "scene".
|
|
* Also a list of possibly following scene names is maintained.
|
|
*/
|
|
class KScene: public TQPtrList<KFrame>
|
|
{
|
|
public:
|
|
/**
|
|
* The constructor initiates the list of following scene names.
|
|
* Attention: this list uses the autoDelete functionality as the KScene itself do.
|
|
*/
|
|
KScene();
|
|
/**
|
|
* The destructor deletes the list of following scene names.
|
|
*/
|
|
~KScene();
|
|
|
|
/**
|
|
* @return a pointer to the current frame or 0, if the list is empty.
|
|
*/
|
|
KFrame *currentFrame();
|
|
/**
|
|
* increases the current frame. Resets the scene, if the laste frame was reached.
|
|
* @return a pointer to the next frame or 0, if there is no frame left or the list is empty
|
|
*/
|
|
KFrame *nextFrame();
|
|
|
|
/**
|
|
* adds a scene name
|
|
*/
|
|
void addFollowingScene( const TQString scene_name );
|
|
/**
|
|
* selects a scene out of the list of possibly following scenes.
|
|
*/
|
|
void followingSceneName( TQString& scene_name);
|
|
|
|
void setToStart();
|
|
|
|
private:
|
|
TQStrList *following;
|
|
unsigned int current_frame_number;
|
|
};
|
|
|
|
/**
|
|
* KStoryBoard
|
|
*/
|
|
class KStoryBoard: public TQDict<KScene>
|
|
{
|
|
public:
|
|
KStoryBoard( const TQString filename );
|
|
~KStoryBoard();
|
|
|
|
KFrame *nextFrame();
|
|
KFrame *currentFrame();
|
|
void setToStart();
|
|
|
|
private:
|
|
KScene *current_scene;
|
|
};
|
|
|
|
class KAnimation: public TQCanvasSprite
|
|
{
|
|
public:
|
|
KAnimation( const TQString stroy_filename, TQCanvasPixmapArray *a, TQCanvas *canvas );
|
|
~KAnimation();
|
|
|
|
virtual void advance( int phase );
|
|
|
|
void setToStart();
|
|
|
|
KStoryBoard *story;
|
|
};
|
|
|
|
#endif
|