summaryrefslogtreecommitdiff
path: root/main.h
diff options
context:
space:
mode:
Diffstat (limited to 'main.h')
-rw-r--r--main.h114
1 files changed, 114 insertions, 0 deletions
diff --git a/main.h b/main.h
new file mode 100644
index 0000000..17c0e3c
--- /dev/null
+++ b/main.h
@@ -0,0 +1,114 @@
1/*
2THIS PROJECT IS USING OPEN SANS TRUE TYPE FONTS
3see: www.google.com/fonts/specimen/Open+Sans
4You find a copy ofthe license under /data/fonts/
5*/
6
7#include "engine.h"
8
9using 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
18const int SCREEN_WIDTH = 500;
19const int SCREEN_HEIGHT = 500;
20const int SCREEN_BPP = 32;
21
22//class UpgradesMenu: public Menu
23//{
24//public:
25// vector<string> labels;
26//
27//};
28
29class Shop: public AbstractInteractive
30{
31protected:
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;
45public:
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
56class InventoryMenu: public AbstractInteractive
57{
58public:
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
89bool init(SDL_Surface*& screen);
90
91Menu* makeMainMenu(SDL_Surface *screen);
92Menu* makeGameMenu(SDL_Surface *screen);
93Menu* makeLevelMenu(vector<string> levels, SDL_Surface *screen);
94
95class GameHandler
96{
97private:
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;
106public:
107 GameHandler();
108 ~GameHandler();
109// returns 0 if succesfully quits, 1 otherwise
110 int game();
111};
112
113int main(int argc, char* args[]);
114