diff options
| author | Reimar <Reimar@Leike.name> | 2015-12-08 11:31:35 +0100 |
|---|---|---|
| committer | Reimar <Reimar@Leike.name> | 2015-12-08 11:31:35 +0100 |
| commit | e3a66514d57ff4acf2f02df7d86bd2cf8be0e730 (patch) | |
| tree | 686eabd8aac2f2eb9d0b3429fe0feee3f031904a /main.h | |
| download | RCade-e3a66514d57ff4acf2f02df7d86bd2cf8be0e730.tar RCade-e3a66514d57ff4acf2f02df7d86bd2cf8be0e730.tar.gz RCade-e3a66514d57ff4acf2f02df7d86bd2cf8be0e730.tar.bz2 RCade-e3a66514d57ff4acf2f02df7d86bd2cf8be0e730.tar.xz RCade-e3a66514d57ff4acf2f02df7d86bd2cf8be0e730.zip | |
initial commit
Diffstat (limited to 'main.h')
| -rw-r--r-- | main.h | 114 |
1 files changed, 114 insertions, 0 deletions
| @@ -0,0 +1,114 @@ | |||
| 1 | /* | ||
| 2 | THIS PROJECT IS USING OPEN SANS TRUE TYPE FONTS | ||
| 3 | see: www.google.com/fonts/specimen/Open+Sans | ||
| 4 | You find a copy ofthe license under /data/fonts/ | ||
| 5 | */ | ||
| 6 | |||
| 7 | #include "engine.h" | ||
| 8 | |||
| 9 | using namespace std; | ||
| 10 | |||
| 11 | #define LEVEL (1 << 30) | ||
| 12 | #define MENU (1 << 29) | ||
| 13 | #define LOAD (1 << 27) | ||
| 14 | #define SAVE (1 << 26) | ||
| 15 | #define GAME_QUIT (1 << 28) | ||
| 16 | |||
| 17 | |||
| 18 | const int SCREEN_WIDTH = 500; | ||
| 19 | const int SCREEN_HEIGHT = 500; | ||
| 20 | const int SCREEN_BPP = 32; | ||
| 21 | |||
| 22 | //class UpgradesMenu: public Menu | ||
| 23 | //{ | ||
| 24 | //public: | ||
| 25 | // vector<string> labels; | ||
| 26 | // | ||
| 27 | //}; | ||
| 28 | |||
| 29 | class Shop: public AbstractInteractive | ||
| 30 | { | ||
| 31 | protected: | ||
| 32 | Account** user; | ||
| 33 | vector<Upgradeable*> tu; | ||
| 34 | vector<Weapon*> weapons; | ||
| 35 | vector<AbstractInteractive*> weaponInfos; | ||
| 36 | int currentWeapon; | ||
| 37 | vector<UserShip*> ships; | ||
| 38 | vector<AbstractInteractive*> shipInfos; | ||
| 39 | int currentShip; | ||
| 40 | vector<bool*> disabledUpgrades; | ||
| 41 | int gameMenu; | ||
| 42 | Button* back; | ||
| 43 | CompositMenu* menu; | ||
| 44 | Label* goldLabel; | ||
| 45 | public: | ||
| 46 | Shop(){} | ||
| 47 | ~Shop(); | ||
| 48 | Shop(Account** user, int GameMenu); | ||
| 49 | void draw(SDL_Surface *screen); | ||
| 50 | int handleEvents(SDL_Event event); | ||
| 51 | void frame(double time); | ||
| 52 | void updateUpgradeMenu(); | ||
| 53 | virtual void refresh(); | ||
| 54 | }; | ||
| 55 | |||
| 56 | class InventoryMenu: public AbstractInteractive | ||
| 57 | { | ||
| 58 | public: | ||
| 59 | Label* title; | ||
| 60 | SlidingBackground* BG; | ||
| 61 | Account** user; | ||
| 62 | int gameMenu; | ||
| 63 | Button* back; | ||
| 64 | Label* sellLabel; | ||
| 65 | SDL_Rect sellDropzone; | ||
| 66 | AbstractInteractive* shipMenu; | ||
| 67 | vector<SDL_Surface*> ships; | ||
| 68 | AbstractInteractive* weaponMenu; | ||
| 69 | vector<SDL_Surface*> weapons; | ||
| 70 | SDL_Rect weaponDropzone; | ||
| 71 | vector<Button*> slots; | ||
| 72 | //always NULL if nothing is dragged | ||
| 73 | SDL_Surface* cursor; | ||
| 74 | //wich item is currently dragged | ||
| 75 | int dragged; | ||
| 76 | int MX; | ||
| 77 | int MY; | ||
| 78 | SDL_Surface* ship; | ||
| 79 | |||
| 80 | |||
| 81 | ~InventoryMenu(); | ||
| 82 | InventoryMenu(Account** user, int ngamMenu); | ||
| 83 | void draw(SDL_Surface *screen); | ||
| 84 | int handleEvents(SDL_Event event); | ||
| 85 | void frame(double time); | ||
| 86 | void refresh(); | ||
| 87 | }; | ||
| 88 | |||
| 89 | bool init(SDL_Surface*& screen); | ||
| 90 | |||
| 91 | Menu* makeMainMenu(SDL_Surface *screen); | ||
| 92 | Menu* makeGameMenu(SDL_Surface *screen); | ||
| 93 | Menu* makeLevelMenu(vector<string> levels, SDL_Surface *screen); | ||
| 94 | |||
| 95 | class GameHandler | ||
| 96 | { | ||
| 97 | private: | ||
| 98 | Account *user; | ||
| 99 | SDL_Surface *screen; | ||
| 100 | LevelGenerator *LG; | ||
| 101 | vector<AbstractInteractive*> menus; | ||
| 102 | vector<string> levelpaths; | ||
| 103 | bool isGood; | ||
| 104 | int state; | ||
| 105 | string* acname; | ||
| 106 | public: | ||
| 107 | GameHandler(); | ||
| 108 | ~GameHandler(); | ||
| 109 | // returns 0 if succesfully quits, 1 otherwise | ||
| 110 | int game(); | ||
| 111 | }; | ||
| 112 | |||
| 113 | int main(int argc, char* args[]); | ||
| 114 | |||
