00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef FLAME_H_
00015 #define FLAME_H_
00016
00017 #include "../Config.h"
00018
00019 #include "../Graphics/draw.h"
00020 #include "../Util/STL_Helper.h"
00021
00022 #include <list>
00023
00024 namespace Game {
00025 namespace Constants {
00026 const int FLAME_DURATION=40;
00027 };
00028
00029 enum FlameType {
00030 FLAME_HORIZ_CONNECTOR=0,
00031 FLAME_VERT_CONNECTOR,
00032 FLAME_MIDDLE_CONNECTOR,
00033 FLAME_LEFT_END,
00034 FLAME_RIGHT_END,
00035 FLAME_UP_END,
00036 FLAME_DOWN_END,
00037 };
00038
00042 class Flame : public Graphics::DrawableAt {
00043 public:
00044 Flame();
00045 ~Flame();
00047 void drawAt(SDL_Surface* surf, SDL_Rect* loc);
00048
00052 bool isOnFire();
00053
00058 void addSpark(FlameType spark, int duration = Constants::FLAME_DURATION);
00059 private:
00060 struct Spark {
00061 Spark(FlameType f, int dur);
00062 FlameType spark;
00063 int duration;
00064 };
00065 int maxSparkDuration;
00066 std::list<Spark*> sparkList;
00067 };
00068
00069 class FlameImageManager {
00070 public:
00071 static FlameImageManager* getInstance();
00072 static void destroy();
00073 Graphics::DrawableAt* getImage(FlameType t);
00074 private:
00075 FlameImageManager();
00076 ~FlameImageManager();
00077 std::vector<Graphics::AbstractImage*> flames;
00078 static FlameImageManager* instance;
00079 };
00080
00081 };
00082
00083
00084 #endif // ifndef FLAME_H_