blob: 207e05e189a7dc8c3a25dee1eb204b01db55c781 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
/*
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)
string SAVE_PATH = "save/";
string DATA_PATH = "data/";
const int SCREEN_WIDTH = 500;
const int SCREEN_HEIGHT = 500;
const int SCREEN_BPP = 32;
//class UpgradesMenu: public Menu
//{
//public:
// vector<string> labels;
//
//};
class Shop: public AbstractInteractive
{
protected:
Account** user;
vector<Upgradeable*> tu;
vector<Weapon*> weapons;
vector<AbstractInteractive*> weaponInfos;
int currentWeapon;
vector<UserShip*> ships;
vector<AbstractInteractive*> shipInfos;
int currentShip;
vector<bool*> 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<SDL_Surface*> ships;
AbstractInteractive* weaponMenu;
vector<SDL_Surface*> weapons;
SDL_Rect weaponDropzone;
vector<Button*> 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<string> levels, SDL_Surface *screen);
class GameHandler
{
private:
Account *user;
SDL_Surface *screen;
LevelGenerator *LG;
vector<AbstractInteractive*> menus;
vector<string> 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[]);
|