From e3a66514d57ff4acf2f02df7d86bd2cf8be0e730 Mon Sep 17 00:00:00 2001 From: Reimar Date: Tue, 8 Dec 2015 11:31:35 +0100 Subject: initial commit --- engine.h | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 engine.h (limited to 'engine.h') diff --git a/engine.h b/engine.h new file mode 100644 index 0000000..fad0642 --- /dev/null +++ b/engine.h @@ -0,0 +1,119 @@ +#ifndef ENGINE_H +#define ENGINE_H + +#include "enginecore.h" +#include "GUI.h" + +#define LEVEL_COMPLETED 2 +#define LEVEL_FAILED 1 + +using namespace std; + + +class Account: public Levelable +{ +public: + string name; + double gold; + long long highscore; + //owned ships + vector ships; + //the ship currently used + int current; + //owned weapons that are not in ships + vector weapons; + //list of succesfully played levels + vector levels; + + Account(); + Account(string filename); + ~Account(); + void save(); + + void resetShips(); +}; + +//game engine. deletes everything it gets besides account and screen +class ObjectHandler +{ +protected: + list friendlyProjectiles; + list enemyProjectiles; + list enemies; +public: + SlidingBackground* BG; + long long highscore; + double gold; + Account* user; + SDL_Surface* screen; + ObjectHandler(Account* newuser,SDL_Surface* newscreen, SDL_Surface *background); + ~ObjectHandler(); + int frame(double time); + void frameEnemy(EnemyShip* s, double time); + void spawnEnemy(EnemyShip* enemy,double nx, double ny); +}; + +class HUD +{ + SDL_Surface* energyRaw; + SlidingBackground* energyBubbles; + SDL_Surface* energyMasc; + double Bubblesypos; + SDL_Surface* hpRaw; + SDL_Surface* hpMasc; + SDL_Surface *background; + TTF_Font *font; +public: + long long* highscore; + double* hp; + double hpmax; + double* energy; + double maxEnergy; + double *gold; + double *exp; + SDL_Color textColor; + HUD(long long *nhighscore, double *nhp, double nhpmax, double *nenergy, double nmaxEnergy, double* ngold, double* nexp); + ~HUD(); + void draw(SDL_Surface *screen); +}; + +class LevelEvent +{ +}; + +LevelEvent* createEvent(ifstream& ins); + +class LevelGenerator +{ + Uint32 seed; + HUD *hud; + //collects the soundfiles that have been loaded and cleans them + vector toDelete; +public: + //what ships will come in the Level -bosses + vector prototypes; + vector > events; + //duration of the level -bosses + double duration; + //[(spawn%,(enemytype,path))] of each enemy + vector > > > > spawnQueue; + int current; + //if there is currently an event happening + bool event; + //% of level completed + double completed; + ObjectHandler* OH; + string name; + SDL_Surface* screen; + + LevelGenerator(string filename, Account* user, SDL_Surface* screen); + ~LevelGenerator(); + int frame(double time); +}; + +vector > > > generateWave(int number, int Nweapons,SDL_Surface* screen); + + + + +#endif -- cgit v1.2.3