- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# C:/Documents and Settings/jegan/Desktop/projectX/AnimatedSprite.h

Go to the documentation of this file.

    00001 #pragma once
    00002 #include "sprite.h"
    00003 #include <vector>
    00004 #include <string>
    00005 #include "parser.h"
    00006 #include "List.h"
    00007
    00008 struct SpriteTime
    00009 {
    00010         Sprite* s;
    00011         int time;
    00012 };
    00013
    00014 class AnimatedSprite : public Sprite
    00015 {
    00016 public:
    00017         //AnimatedSprite(std::string filename);
    00018         //AnimatedSprite(std::string filename, int width, int height);
    00019         AnimatedSprite( std::string filename, List *spriteInfo );
    00020         AnimatedSprite(AnimatedSprite *sprite);
    00021         ~AnimatedSprite();
    00022
    00023         Sprite* instance();
    00024
    00025         virtual void update();
    00026         virtual void draw(int x, int y, bool origin = LEVEL);
    00027         virtual void reset() {_index = 0; _time = 0;}
    00028         virtual void clean();
    00029
    00030 protected:
    00031         std::vector<Sprite*> _createdSprites;
    00032         std::vector<SpriteTime> _sprites;
    00033         int _index;
    00034         int _time;
    00035         int _totalTime;
    00036         bool _loop;
    00037 };