00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020
00021
00022
00023 #include "swf.h"
00024
00025 #ifdef RCSID
00026 static char *rcsid = "$Id: sprite.cc,v 1.1.1.1 2002/01/25 22:14:59 kergoth Exp $";
00027 #endif
00028
00029 Sprite::Sprite(FlashMovie *movie, long id, long frameCount) : Character(SpriteType, id)
00030 {
00031 program = new Program(movie, frameCount);
00032 if (program == NULL) return;
00033 if (program->totalFrames == 0) {
00034 delete program;
00035 program = NULL;
00036 return;
00037 }
00038 program->dl->isSprite = 1;
00039 }
00040
00041 Sprite::~Sprite()
00042 {
00043 delete program;
00044 }
00045
00046 void
00047 Sprite::reset()
00048 {
00049 program->rewindMovie();
00050 }
00051
00052 int
00053 Sprite::isSprite(void)
00054 {
00055 return 1;
00056 }
00057
00058 Program *
00059 Sprite::getProgram()
00060 {
00061 return program;
00062 }
00063
00064 int
00065 Sprite::execute(GraphicDevice *gd, Matrix *matrix, Cxform *cxform)
00066 {
00067 return program->dl->render(gd,matrix,cxform);
00068 }
00069
00070 ActionRecord *
00071 Sprite::eventHandler(GraphicDevice *gd, FlashEvent *event)
00072 {
00073 #if 0
00074 DisplayList *dl;
00075 ActionRecord *actions;
00076
00077 dl = program->getDisplayList();
00078 actions = dl->processEvent(gd, event);
00079 if (actions) {
00080 program->doAction(actions,0);
00081 }
00082 return actions;
00083 #endif
00084 return NULL;
00085 }
00086
00087 void
00088 Sprite::getBoundingBox(Rect *bb, DisplayListEntry *e)
00089 {
00090 program->dl->getBoundary(bb);
00091 }