From e3a66514d57ff4acf2f02df7d86bd2cf8be0e730 Mon Sep 17 00:00:00 2001 From: Reimar Date: Tue, 8 Dec 2015 11:31:35 +0100 Subject: initial commit --- main.h | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 main.h (limited to 'main.h') diff --git a/main.h b/main.h new file mode 100644 index 0000000..17c0e3c --- /dev/null +++ b/main.h @@ -0,0 +1,114 @@ +/* +THIS PROJECT IS USING OPEN SANS TRUE TYPE FONTS +see: www.google.com/fonts/specimen/Open+Sans +You find a copy ofthe license under /data/fonts/ +*/ + +#include "engine.h" + +using namespace std; + +#define LEVEL (1 << 30) +#define MENU (1 << 29) +#define LOAD (1 << 27) +#define SAVE (1 << 26) +#define GAME_QUIT (1 << 28) + + +const int SCREEN_WIDTH = 500; +const int SCREEN_HEIGHT = 500; +const int SCREEN_BPP = 32; + +//class UpgradesMenu: public Menu +//{ +//public: +// vector labels; +// +//}; + +class Shop: public AbstractInteractive +{ +protected: + Account** user; + vector tu; + vector weapons; + vector weaponInfos; + int currentWeapon; + vector ships; + vector shipInfos; + int currentShip; + vector disabledUpgrades; + int gameMenu; + Button* back; + CompositMenu* menu; + Label* goldLabel; +public: + Shop(){} + ~Shop(); + Shop(Account** user, int GameMenu); + void draw(SDL_Surface *screen); + int handleEvents(SDL_Event event); + void frame(double time); + void updateUpgradeMenu(); + virtual void refresh(); +}; + +class InventoryMenu: public AbstractInteractive +{ +public: + Label* title; + SlidingBackground* BG; + Account** user; + int gameMenu; + Button* back; + Label* sellLabel; + SDL_Rect sellDropzone; + AbstractInteractive* shipMenu; + vector ships; + AbstractInteractive* weaponMenu; + vector weapons; + SDL_Rect weaponDropzone; + vector slots; + //always NULL if nothing is dragged + SDL_Surface* cursor; + //wich item is currently dragged + int dragged; + int MX; + int MY; + SDL_Surface* ship; + + + ~InventoryMenu(); + InventoryMenu(Account** user, int ngamMenu); + void draw(SDL_Surface *screen); + int handleEvents(SDL_Event event); + void frame(double time); + void refresh(); +}; + +bool init(SDL_Surface*& screen); + +Menu* makeMainMenu(SDL_Surface *screen); +Menu* makeGameMenu(SDL_Surface *screen); +Menu* makeLevelMenu(vector levels, SDL_Surface *screen); + +class GameHandler +{ +private: + Account *user; + SDL_Surface *screen; + LevelGenerator *LG; + vector menus; + vector levelpaths; + bool isGood; + int state; + string* acname; +public: + GameHandler(); + ~GameHandler(); +// returns 0 if succesfully quits, 1 otherwise + int game(); +}; + +int main(int argc, char* args[]); + -- cgit v1.2.3