00001 00005 /* 00006 Copyright (C) 2002-2010 UFO: Alien Invasion. 00007 00008 This program is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU General Public License 00010 as published by the Free Software Foundation; either version 2 00011 of the License, or (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 See the GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 00023 */ 00024 00025 #ifndef IPARTICLES_H_ 00026 #define IPARTICLES_H_ 00027 00028 #include "generic/constant.h" 00029 #include <map> 00030 #include <string> 00031 00032 class IParticleDefinition 00033 { 00034 public: 00035 virtual ~IParticleDefinition () 00036 { 00037 } 00038 virtual std::string& getModel () const = 0; 00039 00040 virtual std::string& getImage () const = 0; 00041 00042 virtual void render (int x, int y) const = 0; 00043 00044 virtual int getHeight () const = 0; 00045 00046 virtual int getWidth () const = 0; 00047 }; 00048 00049 typedef std::map<std::string, IParticleDefinition> ParticleDefinitionMap; 00050 00051 class ParticleSystem 00052 { 00053 public: 00054 INTEGER_CONSTANT(Version, 1); 00055 STRING_CONSTANT(Name, "particles"); 00056 00057 virtual ~ParticleSystem () 00058 { 00059 } 00060 virtual ParticleDefinitionMap getParticleDefinitions () = 0; 00061 }; 00062 00063 #include "modulesystem.h" 00064 00065 template<typename Type> 00066 class GlobalModule; 00067 typedef GlobalModule<ParticleSystem> GlobalParticleModule; 00068 00069 template<typename Type> 00070 class GlobalModuleRef; 00071 typedef GlobalModuleRef<ParticleSystem> GlobalParticleModuleRef; 00072 00073 inline ParticleSystem& GlobalParticleSystem () 00074 { 00075 return GlobalParticleModule::getTable(); 00076 } 00077 00078 #endif