00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020
00021
00022
00024
00025
00027
00028 #ifndef STARFIELD_H
00029 #define STARFIELD_H
00030
00031 #include "Star.hpp"
00032 #include <list>
00033 #include <string>
00034 #include <vector>
00035
00036 #define STARFIELD_PLANET_CHANCE 1
00037 #define STARFIELD_PLANET_MAXCHANCE 4000
00038 #define STARFIELD_PLANET_DELAY 1000
00039
00040 #define STARFIELD_ASTEROID_CHANCE 1
00041 #define STARFIELD_ASTEROID_MAXCHANCE 4000
00042 #define STARFIELD_ASTEROID_MINSIZE 6
00043 #define STARFIELD_ASTEROID_MAXSIZE 9
00044
00045 #define STARFIELD_STAR_FRONT 110
00046
00048
00052 class CStarfield
00053 {
00054 public:
00056 CStarfield();
00057 ~CStarfield();
00058
00060 void Init(const std::string& FileName);
00061
00063 void DrawBack();
00064
00066 void DrawFront();
00067
00069 void RemovePlanets();
00070
00072 void SetSpawnPlanets(bool Spawning) { m_SpawnPlanets = Spawning; }
00073
00075 bool IsSpawningPlanets() const { return m_SpawnPlanets; }
00076
00078 void SetWidth(int Width);
00079 private:
00080
00081 void CleanUp();
00082
00083
00084 void ReadData(std::string FileName, std::string* StarFile, int* StarCount);
00085
00086
00087 void InsertStarBack(CStar* Star);
00088
00089
00090 void InsertStarFront(CStar* Star);
00091
00092
00093 void CheckForNewPlanet();
00094
00095
00096 void CheckForNewAsteroids();
00097
00098 std::vector<AsteroidData*> m_AsteroidData;
00099 std::list<CStar*> m_StarsFront;
00100 std::list<CStar*> m_StarsBack;
00101 std::vector<std::string> m_PlanetFiles;
00102
00103 bool m_SpawnPlanets;
00104 int m_PlanetSpawnTime;
00105 int m_LastPlanet;
00106
00107 int m_Width;
00108 };
00109
00110 #endif
00111