summaryrefslogtreecommitdiff
path: root/engine.h
diff options
context:
space:
mode:
Diffstat (limited to 'engine.h')
-rw-r--r--engine.h119
1 files changed, 119 insertions, 0 deletions
diff --git a/engine.h b/engine.h
new file mode 100644
index 0000000..fad0642
--- /dev/null
+++ b/engine.h
@@ -0,0 +1,119 @@
1#ifndef ENGINE_H
2#define ENGINE_H
3
4#include "enginecore.h"
5#include "GUI.h"
6
7#define LEVEL_COMPLETED 2
8#define LEVEL_FAILED 1
9
10using namespace std;
11
12
13class Account: public Levelable
14{
15public:
16 string name;
17 double gold;
18 long long highscore;
19 //owned ships
20 vector<UserShip*> ships;
21 //the ship currently used
22 int current;
23 //owned weapons that are not in ships
24 vector<Weapon*> weapons;
25 //list of succesfully played levels
26 vector<int> levels;
27
28 Account();
29 Account(string filename);
30 ~Account();
31 void save();
32
33 void resetShips();
34};
35
36//game engine. deletes everything it gets besides account and screen
37class ObjectHandler
38{
39protected:
40 list<Projectile*> friendlyProjectiles;
41 list<Projectile*> enemyProjectiles;
42 list<EnemyShip*> enemies;
43public:
44 SlidingBackground* BG;
45 long long highscore;
46 double gold;
47 Account* user;
48 SDL_Surface* screen;
49 ObjectHandler(Account* newuser,SDL_Surface* newscreen, SDL_Surface *background);
50 ~ObjectHandler();
51 int frame(double time);
52 void frameEnemy(EnemyShip* s, double time);
53 void spawnEnemy(EnemyShip* enemy,double nx, double ny);
54};
55
56class HUD
57{
58 SDL_Surface* energyRaw;
59 SlidingBackground* energyBubbles;
60 SDL_Surface* energyMasc;
61 double Bubblesypos;
62 SDL_Surface* hpRaw;
63 SDL_Surface* hpMasc;
64 SDL_Surface *background;
65 TTF_Font *font;
66public:
67 long long* highscore;
68 double* hp;
69 double hpmax;
70 double* energy;
71 double maxEnergy;
72 double *gold;
73 double *exp;
74 SDL_Color textColor;
75 HUD(long long *nhighscore, double *nhp, double nhpmax, double *nenergy, double nmaxEnergy, double* ngold, double* nexp);
76 ~HUD();
77 void draw(SDL_Surface *screen);
78};
79
80class LevelEvent
81{
82};
83
84LevelEvent* createEvent(ifstream& ins);
85
86class LevelGenerator
87{
88 Uint32 seed;
89 HUD *hud;
90 //collects the soundfiles that have been loaded and cleans them
91 vector<Mix_Chunk*> toDelete;
92public:
93 //what ships will come in the Level -bosses
94 vector<EnemyShip*> prototypes;
95 vector<pair<double,LevelEvent*> > events;
96 //duration of the level -bosses
97 double duration;
98 //[(spawn%,(enemytype,path))] of each enemy
99 vector<pair<double,pair<int,vector<pair<double,double> > > > > spawnQueue;
100 int current;
101 //if there is currently an event happening
102 bool event;
103 //% of level completed
104 double completed;
105 ObjectHandler* OH;
106 string name;
107 SDL_Surface* screen;
108
109 LevelGenerator(string filename, Account* user, SDL_Surface* screen);
110 ~LevelGenerator();
111 int frame(double time);
112};
113
114vector<pair<double,vector<pair<double,double> > > > generateWave(int number, int Nweapons,SDL_Surface* screen);
115
116
117
118
119#endif