1 /*
2  * DESCRIPCION DEL JUEGO
3  * Copyright (C) 2007  Javier P�rez Pacheco
4  *
5  * Este juego tienen licencia Creative Commons y se permite
6  * su modificacion y utilizacion libremente siempre y cuando se
7  * cite al autor original y se comparta con la misma licencia.
8  * No se permite su uso comercial.
9  *
10  * Para mas informacion visite la web:
11  * http://creativecommons.org/licenses/by-nc-sa/2.0/es/
12  *
13  * PROGRAMADOR
14  * Javier P�rez Pacheco
15  * Cadiz (Spain)
16  * javielinux@gmail.com
17  *
18  * GRAFISMO Y 3D
19  * Jesus Carrasco
20  * Cadiz (Spain)
21  * carrasco.carrasco@gmail.com
22  *
23  * MUSICA Y GRAFISMO
24  * Shano Lores
25  * Cadiz (Spain)
26  * shanakla@gmail.com
27  *
28  */
29 
30 #ifndef SCENECREATEMISSION_H_
31 #define SCENECREATEMISSION_H_
32 
33 #include "martian.h"
34 #include "scene.h"
35 #include "missions.h"
36 #include "font.h"
37 
38 using namespace std;
39 using namespace Martian;
40 
41 #define SCENE_CREATEMISSION_MAIN 0
42 #define SCENE_CREATEMISSION_NEW 1
43 #define SCENE_CREATEMISSION_LEVELS 2
44 #define SCENE_CREATEMISSION_NEWLEVEL 3
45 #define SCENE_CREATEMISSION_HELP 4
46 
47 class SceneCreateMission;
48 
49 class ButtonLevel : public Group  {
50 
51 private:
52 	Element *bg, *bgNumber;
53 	Button *title;
54 	Element *number;
55 	Button *bEdit, *bUp, *bDown, *bDelete;
56 	int indexz;
57 	int index;
58 
59 public:
60 	ButtonLevel (string t);
61 	~ButtonLevel();
62 
63 	void setNumber (int i);
64 	void setTitle(string t);
65 
66 	void setIndex (int i);
getIndex()67 	int getIndex () { return index; }
68 
getButtonUp()69 	Button* getButtonUp () { return bUp; }
getButtonDown()70 	Button* getButtonDown () { return bDown; }
71 
setIndexZ(int z)72 	void setIndexZ (int z) { indexz = z; }
getIndexZ()73 	int getIndexZ () { return indexz; }
74 
75 	void draw();
76 
77 	void onOver();
78 
79 	void unLoad();
80 
81 	bool verifyClick(SceneCreateMission *sc);
82 
83 };
84 
85 
86 class SceneCreateMission : public Scene {
87 
88 private:
89 
90 	Button* bNewMission;
91 	Button* bNewLevel;
92 	Button* bBack;
93 	Button* bQuit;
94 	Button* bCreateMission;
95 	Button* bCreateLevel;
96 	Button* bPlay;
97 	Button* bEdit;
98 	Button* bHelp;
99 
100 	Element *bgCoverFlow, *bgInfoMission, *bgLevels;
101 
102 	Element *textHelp;
103 
104 	Element *bgFormMission, *bgFormLevel;
105 	Element *titleFormMission, *titleFormLevel;
106 
107 	Element *nameMissionCover, *authorMissionCover, *nLevelsCover;
108 
109 	Element *frameUpLevels, *frameUp, *frameDown, *faceEnemy1;
110 
111 	Element *nomission, *nolevels;
112     Element *titleMission;
113 
114     ParticlesSystem *stars;
115 
116 	int indexMissionActive;
117 
118 	int nElmHelp;
119 
120 public:
121 	Element *bgHelp;
122 	Element *elmHelp;
123 
124 	Element *titleIndex;
125 
126 	Button *bIndex, *bPrevious, *bNext, * bCancel;
127 
128 	Button *bHelp1, *bHelp2, *bHelp3, *bHelp4;
129 
130 	CoverFlow *dataMissions;
131 	ListView *dataLevel;
132 
133 	Entry *missionName;
134 	Entry *nameAuthor;
135 	//Entry *emailAuthor;
136 
137 	Entry *levelName;
138 	Entry *provinceName;
139 
140 	Element *titleTypeScenary;
141 
142 	RadioButton *tScOpened, *tScClosed;
143 
144 	SceneCreateMission();
145 	~SceneCreateMission();
146 	void load();
147 
148 	void setStatusScene(int s);
149 
150 	string getNameProject(string name);
151 
152 	void createMissionsButtons();
153 
154 	void createLevelsButtons(Mission *mission);
155 
previousElmHelp()156 	void previousElmHelp() { if (nElmHelp>=0) { setElmHelp(nElmHelp-1); } }
nextElmHelp()157 	void nextElmHelp() { if (nElmHelp<elmHelp->getFrames()-1) { setElmHelp(nElmHelp+1); } }
158 	void setElmHelp(int i);
159 
160 	/*********************
161 	* BUTTONS
162 	**********************/
163 	void verifyClickElements_Main();
164 	void verifyOverElements_Main();
165 
166 	void verifyClickElements_NewMision();
167 	void verifyOverElements_NewMision();
168 
169 	void verifyClickElements_Levels();
170 	void verifyOverElements_Levels();
171 
172 	void verifyClickElements_NewLevel();
173 	void verifyOverElements_NewLevel();
174 
175 	void verifyClickElements_Help();
176 	void verifyOverElements_Help();
177 
178 	/*********************
179 	* ESCENES
180 	**********************/
181 	bool drawScene ();
182 
183 	void drawSceneMain ();
184 	void drawSceneMainByIndexZ(int z);
185 
186 	void drawSceneNewMission ();
187 	void drawSceneNewMissionByIndexZ(int z);
188 
189 	void drawSceneLevels ();
190 	void drawSceneLevelsByIndexZ(int z);
191 
192 	void drawSceneNewLevel ();
193 	void drawSceneNewLevelByIndexZ(int z);
194 
195 	void drawSceneHelp ();
196 	void drawSceneHelpByIndexZ(int z);
197 
198 	/*********************
199 	* CONTROL
200 	**********************/
201 	void unLoad();
202 };
203 
204 
205 
206 #endif /* SCENECREATEMISSION_H_ */
207