TapestryEngine

A 2D Platformer Game Engine
Log | Files | Refs

f1fbc8898a3db380b7b8cf54866eebc4f435d557.svn-base (2065B)


      1 #ifndef PARTICLE_H
      2 #define PARTICLE_H
      3 
      4 #include "Utils.h"
      5 #include "Console.h"
      6 #include "Event.h"
      7 #include "Actor.h"
      8 
      9 struct ParticleData
     10 {
     11 	//AnimDataPack* AnimData;
     12 	AnimGraph* AnimData;
     13 	int Height;
     14 	int Width;
     15 	EventReceiver* spat;
     16 };
     17 
     18 
     19 class Particle : public Mobile
     20 {
     21 public:
     22 //	Particle() {}
     23 
     24 	Particle(AnimGraph* AnimData, SDL_Rect Pos, int ID, ActorHandleManager* AHM);
     25 
     26 //	Particle(const Particle& that)
     27 //	{
     28 //		gCons->ConsPrintf("no pls\n");
     29 //	}
     30 
     31 	~Particle()
     32 	{
     33 
     34 	}
     35 
     36 	//bool EventProcess(Event eve);
     37 
     38 	//bool UpdateAnimation();
     39 
     40 	//bool ActorUpdate();
     41 
     42 	void setID(int i)
     43 	{
     44 		mID = i;
     45 	}
     46 
     47 	int GetID()
     48 	{
     49 		return mID;
     50 	}
     51 
     52 	EventFeed mFeed;
     53 protected:
     54 
     55 	int mID;
     56 
     57 private:
     58 	//Particle(const Particle& that);
     59 };
     60 
     61 class P_static : public Particle
     62 {
     63 public:
     64 
     65 	P_static(AnimGraph* AnimData, SDL_Rect Pos, int ID, ActorHandleManager* AHM) : Particle(AnimData, Pos, ID, AHM)
     66 	{}
     67 
     68 	bool EventProcess(Event eve);
     69 
     70 	bool UpdateAnimation();
     71 
     72 	bool ActorUpdate();
     73 
     74 protected:
     75 };
     76 
     77 
     78 class P_drift : public Particle
     79 {
     80 public:
     81 
     82 	P_drift(AnimGraph* AnimData, SDL_Rect Pos, int ID, ActorHandleManager* AHM, drift_data data);
     83 
     84 	bool Drift();
     85 
     86 	bool EventProcess(Event eve);
     87 
     88 	bool UpdateAnimation();
     89 
     90 	bool ActorUpdate();
     91 
     92 protected:
     93 	
     94 	drift_data mData;
     95 
     96 };
     97 
     98 class ParticleManager : public EventReceiver
     99 {
    100 public:
    101 
    102 	bool LogParticleData(ParticleData* pd, char* name)
    103 	{
    104 		mParticleData.push_back(pd);
    105 		mNames.push_back(name);
    106 		particlesKilled = 0;
    107 		return true;
    108 	}
    109 
    110 	ParticleData* GetParticleData(char* name)
    111 	{
    112 		for (int i = 0; i < (int)mParticleData.size(); i++)
    113 		{
    114 			if (!strcmp(name, mNames.at(i)))
    115 			{
    116 				return mParticleData.at(i);
    117 			}
    118 		}
    119 		return NULL;
    120 	}
    121 
    122 	bool SpawnParticle(char* type, char* name, int x, int y, ParticleTypeData ptdata = NullPTdata() );
    123 
    124 	bool ClearParticle(Particle* prt);
    125 
    126 	bool EventProcess(Event eve);
    127 	
    128 	std::vector<Particle*>* GetParticles()
    129 	{
    130 		return &mParticles;
    131 	}
    132 
    133 protected:
    134 
    135 	std::vector<ParticleData*> mParticleData;
    136 	std::vector<char*> mNames;
    137 
    138 	std::vector<Particle*> mParticles;
    139 
    140 	int particlesKilled;
    141 };
    142 
    143 #endif