Hosting courtesy of Sourceforge

SourceForge Logo
Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Flame.h

Go to the documentation of this file.
00001 //
00002 //                                 Flame.h
00003 //                             -------------------
00004 //    begin                : Fri Feb 22 2002
00005 //    copyright            : (C) 2002 by Rob Renaud
00006 //    email                : rrenaud@eden.rutgers.edu
00007 //
00008 //   This program is free software; you can redistribute it and/or modify
00009 //   it under the terms of the GNU General Public License as published by
00010 //   the Free Software Foundation; either version 2 of the License, or
00011 //   (at your option) any later version.
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 }; // namespace Game
00082 
00083 
00084 #endif // ifndef FLAME_H_

Generated on Tue May 21 07:26:51 2002 for BomberLAN by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001