1 /*
2  * Copyright 2011-2012 Arx Libertatis Team (see the AUTHORS file)
3  *
4  * This file is part of Arx Libertatis.
5  *
6  * Arx Libertatis is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Arx Libertatis is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Arx Libertatis.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 /* Based on:
20 ===========================================================================
21 ARX FATALIS GPL Source Code
22 Copyright (C) 1999-2010 Arkane Studios SA, a ZeniMax Media company.
23 
24 This file is part of the Arx Fatalis GPL Source Code ('Arx Fatalis Source Code').
25 
26 Arx Fatalis Source Code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
27 License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
28 
29 Arx Fatalis Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
30 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
31 
32 You should have received a copy of the GNU General Public License along with Arx Fatalis Source Code.  If not, see
33 <http://www.gnu.org/licenses/>.
34 
35 In addition, the Arx Fatalis Source Code is also subject to certain additional terms. You should have received a copy of these
36 additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Arx
37 Fatalis Source Code. If not, please request a copy in writing from Arkane Studios at the address below.
38 
39 If you have questions concerning this license or the applicable additional terms, you may contact in writing Arkane Studios, c/o
40 ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
41 ===========================================================================
42 */
43 
44 #ifndef ARX_GUI_MENUWIDGETS_H
45 #define ARX_GUI_MENUWIDGETS_H
46 
47 #include <vector>
48 #include <string>
49 
50 #include "graphics/Color.h"
51 #include "input/InputKey.h"
52 #include "math/Vector2.h"
53 #include "math/Rectangle.h"
54 
55 class TextureContainer;
56 class Font;
57 
58 // Enum for all the buttons in the menu
59 enum MenuButton {
60 
61 	BUTTON_MENUMAIN_RESUMEGAME = 1,
62 	BUTTON_MENUMAIN_NEWQUEST,
63 	BUTTON_MENUMAIN_LOADQUEST,
64 	BUTTON_MENUMAIN_SAVEQUEST,
65 	BUTTON_MENUMAIN_MULTIPLAYER,
66 	BUTTON_MENUMAIN_OPTIONS,
67 	BUTTON_MENUMAIN_CREDITS,
68 	BUTTON_MENUMAIN_QUIT,
69 
70 	BUTTON_MENUNEWQUEST_CONFIRM,
71 
72 	BUTTON_MENUEDITQUEST_LOAD_INIT,
73 	BUTTON_MENUEDITQUEST_LOAD,
74 	BUTTON_MENUEDITQUEST_LOAD_CONFIRM,
75 	BUTTON_MENUEDITQUEST_SAVE,
76 	BUTTON_MENUEDITQUEST_DELETE,
77 	BUTTON_MENUEDITQUEST_DELETE_CONFIRM,
78 
79 	BUTTON_MENUOPTIONSVIDEO_INIT,
80 	BUTTON_MENUOPTIONSVIDEO_RENDERER,
81 	BUTTON_MENUOPTIONSVIDEO_RESOLUTION,
82 	BUTTON_MENUOPTIONSVIDEO_BPP,
83 	BUTTON_MENUOPTIONSVIDEO_FULLSCREEN,
84 	BUTTON_MENUOPTIONSVIDEO_APPLY,
85 	BUTTON_MENUOPTIONSVIDEO_FOG,
86 	BUTTON_MENUOPTIONSVIDEO_CROSSHAIR,
87 	BUTTON_MENUOPTIONSVIDEO_ANTIALIASING,
88 	BUTTON_MENUOPTIONSVIDEO_VSYNC,
89 	BUTTON_MENUOPTIONSVIDEO_OTHERSDETAILS,
90 
91 	BUTTON_MENUOPTIONSAUDIO_BACKEND,
92 	BUTTON_MENUOPTIONSAUDIO_MASTER,
93 	BUTTON_MENUOPTIONSAUDIO_SFX,
94 	BUTTON_MENUOPTIONSAUDIO_SPEECH,
95 	BUTTON_MENUOPTIONSAUDIO_AMBIANCE,
96 	BUTTON_MENUOPTIONSAUDIO_EAX,
97 
98 	BUTTON_MENUOPTIONS_CONTROLS_CUST_JUMP1,
99 	BUTTON_MENUOPTIONS_CONTROLS_CUST_JUMP2,
100 	BUTTON_MENUOPTIONS_CONTROLS_CUST_MAGICMODE1,
101 	BUTTON_MENUOPTIONS_CONTROLS_CUST_MAGICMODE2,
102 	BUTTON_MENUOPTIONS_CONTROLS_CUST_STEALTHMODE1,
103 	BUTTON_MENUOPTIONS_CONTROLS_CUST_STEALTHMODE2,
104 	BUTTON_MENUOPTIONS_CONTROLS_CUST_WALKFORWARD1,
105 	BUTTON_MENUOPTIONS_CONTROLS_CUST_WALKFORWARD2,
106 	BUTTON_MENUOPTIONS_CONTROLS_CUST_WALKBACKWARD1,
107 	BUTTON_MENUOPTIONS_CONTROLS_CUST_WALKBACKWARD2,
108 	BUTTON_MENUOPTIONS_CONTROLS_CUST_STRAFELEFT1,
109 	BUTTON_MENUOPTIONS_CONTROLS_CUST_STRAFELEFT2,
110 	BUTTON_MENUOPTIONS_CONTROLS_CUST_STRAFERIGHT1,
111 	BUTTON_MENUOPTIONS_CONTROLS_CUST_STRAFERIGHT2,
112 	BUTTON_MENUOPTIONS_CONTROLS_CUST_LEANLEFT1,
113 	BUTTON_MENUOPTIONS_CONTROLS_CUST_LEANLEFT2,
114 	BUTTON_MENUOPTIONS_CONTROLS_CUST_LEANRIGHT1,
115 	BUTTON_MENUOPTIONS_CONTROLS_CUST_LEANRIGHT2,
116 	BUTTON_MENUOPTIONS_CONTROLS_CUST_CROUCH1,
117 	BUTTON_MENUOPTIONS_CONTROLS_CUST_CROUCH2,
118 	BUTTON_MENUOPTIONS_CONTROLS_CUST_MOUSELOOK1,
119 	BUTTON_MENUOPTIONS_CONTROLS_CUST_MOUSELOOK2,
120 	BUTTON_MENUOPTIONS_CONTROLS_CUST_ACTIONCOMBINE1,
121 	BUTTON_MENUOPTIONS_CONTROLS_CUST_ACTIONCOMBINE2,
122 	BUTTON_MENUOPTIONS_CONTROLS_CUST_INVENTORY1,
123 	BUTTON_MENUOPTIONS_CONTROLS_CUST_INVENTORY2,
124 
125 	BUTTON_MENUOPTIONS_CONTROLS_CUST_BOOK1,
126 	BUTTON_MENUOPTIONS_CONTROLS_CUST_BOOK2,
127 	BUTTON_MENUOPTIONS_CONTROLS_CUST_BOOKCHARSHEET1,
128 	BUTTON_MENUOPTIONS_CONTROLS_CUST_BOOKCHARSHEET2,
129 	BUTTON_MENUOPTIONS_CONTROLS_CUST_BOOKSPELL1,
130 	BUTTON_MENUOPTIONS_CONTROLS_CUST_BOOKSPELL2,
131 	BUTTON_MENUOPTIONS_CONTROLS_CUST_BOOKMAP1,
132 	BUTTON_MENUOPTIONS_CONTROLS_CUST_BOOKMAP2,
133 	BUTTON_MENUOPTIONS_CONTROLS_CUST_BOOKQUEST1,
134 	BUTTON_MENUOPTIONS_CONTROLS_CUST_BOOKQUEST2,
135 
136 	BUTTON_MENUOPTIONS_CONTROLS_CUST_DRINKPOTIONLIFE1,
137 	BUTTON_MENUOPTIONS_CONTROLS_CUST_DRINKPOTIONLIFE2,
138 	BUTTON_MENUOPTIONS_CONTROLS_CUST_DRINKPOTIONMANA1,
139 	BUTTON_MENUOPTIONS_CONTROLS_CUST_DRINKPOTIONMANA2,
140 	BUTTON_MENUOPTIONS_CONTROLS_CUST_TORCH1,
141 	BUTTON_MENUOPTIONS_CONTROLS_CUST_TORCH2,
142 
143 	BUTTON_MENUOPTIONS_CONTROLS_CUST_PRECAST1,
144 	BUTTON_MENUOPTIONS_CONTROLS_CUST_PRECAST1_2,
145 	BUTTON_MENUOPTIONS_CONTROLS_CUST_PRECAST2,
146 	BUTTON_MENUOPTIONS_CONTROLS_CUST_PRECAST2_2,
147 	BUTTON_MENUOPTIONS_CONTROLS_CUST_PRECAST3,
148 	BUTTON_MENUOPTIONS_CONTROLS_CUST_PRECAST3_2,
149 	BUTTON_MENUOPTIONS_CONTROLS_CUST_WEAPON1,
150 	BUTTON_MENUOPTIONS_CONTROLS_CUST_WEAPON2,
151 	BUTTON_MENUOPTIONS_CONTROLS_CUST_QUICKLOAD,
152 	BUTTON_MENUOPTIONS_CONTROLS_CUST_QUICKLOAD2,
153 	BUTTON_MENUOPTIONS_CONTROLS_CUST_QUICKSAVE,
154 	BUTTON_MENUOPTIONS_CONTROLS_CUST_QUICKSAVE2,
155 
156 	BUTTON_MENUOPTIONS_CONTROLS_CUST_TURNLEFT1,
157 	BUTTON_MENUOPTIONS_CONTROLS_CUST_TURNLEFT2,
158 	BUTTON_MENUOPTIONS_CONTROLS_CUST_TURNRIGHT1,
159 	BUTTON_MENUOPTIONS_CONTROLS_CUST_TURNRIGHT2,
160 	BUTTON_MENUOPTIONS_CONTROLS_CUST_LOOKUP1,
161 	BUTTON_MENUOPTIONS_CONTROLS_CUST_LOOKUP2,
162 	BUTTON_MENUOPTIONS_CONTROLS_CUST_LOOKDOWN1,
163 	BUTTON_MENUOPTIONS_CONTROLS_CUST_LOOKDOWN2,
164 
165 	BUTTON_MENUOPTIONS_CONTROLS_CUST_STRAFE1,
166 	BUTTON_MENUOPTIONS_CONTROLS_CUST_STRAFE2,
167 	BUTTON_MENUOPTIONS_CONTROLS_CUST_CENTERVIEW1,
168 	BUTTON_MENUOPTIONS_CONTROLS_CUST_CENTERVIEW2,
169 
170 	BUTTON_MENUOPTIONS_CONTROLS_CUST_FREELOOK1,
171 	BUTTON_MENUOPTIONS_CONTROLS_CUST_FREELOOK2,
172 
173 	BUTTON_MENUOPTIONS_CONTROLS_CUST_PREVIOUS1,
174 	BUTTON_MENUOPTIONS_CONTROLS_CUST_PREVIOUS2,
175 	BUTTON_MENUOPTIONS_CONTROLS_CUST_NEXT1,
176 	BUTTON_MENUOPTIONS_CONTROLS_CUST_NEXT2,
177 
178 	BUTTON_MENUOPTIONS_CONTROLS_CUST_CROUCHTOGGLE1,
179 	BUTTON_MENUOPTIONS_CONTROLS_CUST_CROUCHTOGGLE2,
180 
181 	BUTTON_MENUOPTIONS_CONTROLS_CUST_UNEQUIPWEAPON1,
182 	BUTTON_MENUOPTIONS_CONTROLS_CUST_UNEQUIPWEAPON2,
183 
184 	BUTTON_MENUOPTIONS_CONTROLS_CUST_CANCELCURSPELL1,
185 	BUTTON_MENUOPTIONS_CONTROLS_CUST_CANCELCURSPELL2,
186 
187 	BUTTON_MENUOPTIONS_CONTROLS_CUST_MINIMAP1,
188 	BUTTON_MENUOPTIONS_CONTROLS_CUST_MINIMAP2,
189 
190 	BUTTON_MENUOPTIONS_CONTROLS_CUST_TOGGLE_FULLSCREEN1,
191 	BUTTON_MENUOPTIONS_CONTROLS_CUST_TOGGLE_FULLSCREEN2,
192 
193 	BUTTON_MENUOPTIONS_CONTROLS_CUST_BACK,
194 	BUTTON_MENUOPTIONS_CONTROLS_CUST_DEFAULT,
195 
196 	BUTTON_MENUOPTIONS_CONTROLS_BACKEND,
197 	BUTTON_MENUOPTIONS_CONTROLS_INVERTMOUSE,
198 	BUTTON_MENUOPTIONS_CONTROLS_AUTOREADYWEAPON,
199 	BUTTON_MENUOPTIONS_CONTROLS_MOUSELOOK,
200 	BUTTON_MENUOPTIONS_CONTROLS_MOUSESENSITIVITY,
201 	BUTTON_MENUOPTIONS_CONTROLS_AUTODESCRIPTION,
202 	BUTTON_MENUOPTIONS_CONTROLS_QUICKSAVESLOTS,
203 	BUTTON_MENUEDITQUEST_LOAD_CONFIRM_BACK,
204 
205 	BUTTON_MENUOPTIONS_CONTROLS_BACK,
206 
207 	BUTTON_MENUOPTIONS_CONTROLS_LINK,
208 
209 	BUTTON_MENUOPTIONSVIDEO_BACK,
210 
211 	BUTTON_MENUEDITQUEST_SAVEINFO,
212 };
213 
214 //-----------------------------------------------------------------------------
215 enum MENUSTATE
216 {
217 	MAIN,
218 	RESUME_GAME,
219 	NEW_QUEST,
220 	NEW_QUEST_ENTER_GAME,
221 	EDIT_QUEST,
222 	EDIT_QUEST_LOAD,
223 	EDIT_QUEST_SAVE,
224 	EDIT_QUEST_SAVE_CONFIRM,
225 	MULTIPLAYER,
226 	OPTIONS,
227 	OPTIONS_VIDEO,
228 	OPTIONS_VIDEO_RESOLUTION,
229 	OPTIONS_AUDIO,
230 	OPTIONS_INPUT,
231 	OPTIONS_INPUT_CUSTOMIZE_KEYS_1,
232 	OPTIONS_INPUT_CUSTOMIZE_KEYS_2,
233 	CREDITS,
234 	BACK,
235 	QUIT,
236 	NOP,
237 	OPTIONS_LOD,
238 	OPTIONS_OTHERDETAILS,
239 	OPTIONS_VIDEO_RENDERER_OPENGL,
240 	OPTIONS_VIDEO_RENDERER_D3D9,
241 	OPTIONS_VIDEO_RENDERER_AUTOMATIC,
242 	OPTIONS_AUDIO_BACKEND_OPENAL,
243 	OPTIONS_AUDIO_BACKEND_DSOUND,
244 	OPTIONS_AUDIO_BACKEND_AUTOMATIC,
245 	OPTIONS_INPUT_BACKEND_SDL,
246 	OPTIONS_INPUT_BACKEND_DINPUT,
247 	OPTIONS_INPUT_BACKEND_AUTOMATIC,
248 	SAVE_QUEST_0 = 100,
249 	SAVE_QUEST_1 = 101,
250 	SAVE_QUEST_2 = 102,
251 	SAVE_QUEST_3 = 103,
252 	SAVE_QUEST_4 = 104,
253 	SAVE_QUEST_5 = 105,
254 	SAVE_QUEST_6 = 106,
255 	SAVE_QUEST_7 = 107,
256 	SAVE_QUEST_8 = 108,
257 	SAVE_QUEST_9 = 109,
258 	OPTIONS_VIDEO_RESOLUTION_0 = 200,
259 	OPTIONS_AUDIO_VOLUME = 300,
260 	OPTIONS_INPUT_KEY_0 = 400
261 };
262 
263 //-----------------------------------------------------------------------------
264 class CMenuZone
265 {
266 	public:
267 		bool	bActif;
268 		bool	bCheck;
269 		bool	bTestYDouble;
270         CMenuZone *	pRef;
271 		Rect	rZone;
272 		int			iID;
273 		long		lData;
274 		long	*	pData;
275 		long		lPosition;
276 	public:
277 		CMenuZone();
278 		CMenuZone(int, int, int, int, CMenuZone *);
279 		virtual ~CMenuZone();
280 
GetWidth()281 		int GetWidth() const
282 		{
283 			return (rZone.right - rZone.left);
284 		}
GetHeight()285 		int GetHeight() const
286 		{
287 			return (rZone.bottom - rZone.top);
288 		}
289 		virtual void Move(int, int);
290 		virtual void SetPos(float, float);
291 
SetCheckOff()292 		void SetCheckOff()
293 		{
294 			bCheck = false;
295 		}
SetCheckOn()296 		void SetCheckOn()
297 		{
298 			bCheck = true;
299 		};
300 
301 		virtual CMenuZone * IsMouseOver(const Vec2s& mousePos) const;
302 };
303 
304 //-----------------------------------------------------------------------------
305 class CMenuAllZone
306 {
307 	public:
308 		std::vector<CMenuZone *>	vMenuZone;
309 	public:
310 		CMenuAllZone();
311 		virtual ~CMenuAllZone();
312 
313 		void AddZone(CMenuZone * menuZone);
314 		CMenuZone * CheckZone(const Vec2s & mousePos) const;
315 
316 		CMenuZone * GetZoneNum(int zoneNumber);
317 		CMenuZone * GetZoneWithID(int zoneId);
318 		void Move(int dx, int dy);
319 		void DrawZone();
320 		int GetNbZone();
321 };
322 
323 enum ELEMSTATE
324 {
325 	TNOP,
326 	//Element Text
327 	EDIT,           //type d'etat
328 	GETTOUCH,
329 	EDIT_TIME,      //etat en cours
330 	GETTOUCH_TIME
331 };
332 
333 enum ELEMPOS
334 {
335 	NOCENTER,
336 	CENTER,
337 	CENTERY
338 };
339 
340 //-----------------------------------------------------------------------------
341 class CMenuElement : public CMenuZone
342 {
343 	public:
344 		ELEMPOS     ePlace;			//placement de la zone
345 		ELEMSTATE   eState;			//etat de l'element en cours
346 		MENUSTATE   eMenuState;		//etat de retour de l'element
347 		int         iShortCut;
348 	public:
349 		explicit CMenuElement(MENUSTATE);
350 		virtual ~CMenuElement();
351 
352 		virtual CMenuElement * OnShortCut();
353 		virtual bool OnMouseClick(int button) = 0;
354 		virtual void Update(int time) = 0;
355 		virtual void Render() = 0;
RenderMouseOver()356 		virtual void RenderMouseOver() { }
EmptyFunction()357 		virtual void EmptyFunction() { }
OnMouseDoubleClick(int button)358 		virtual bool OnMouseDoubleClick(int button) { ARX_UNUSED(button); return false; }
GetZoneWithID(int zoneId)359 		virtual CMenuZone * GetZoneWithID(int zoneId) {
360 			return (iID == zoneId) ? (CMenuZone *)this : NULL;
361 		}
362 
SetShortCut(int _iShortCut)363 		void SetShortCut(int _iShortCut)
364 		{
365 			iShortCut = _iShortCut;
366 		};
setEnabled(bool enable)367 		virtual void setEnabled(bool enable) {
368 			enabled = enable;
369 		}
370 protected:
371 	bool enabled;
372 };
373 
374 //-----------------------------------------------------------------------------
375 // faire une classe
376 // like a container in java
377 
378 class CMenuPanel : public CMenuElement {
379 
380 	public:
381 		std::vector<CMenuElement *>	vElement;
382 	public:
383 		CMenuPanel();
384 		virtual ~CMenuPanel();
385 
386 		void Move(int dx, int dy);
387 		void AddElement(CMenuElement * element);
388 		void AddElementNoCenterIn(CMenuElement * element);
389 
390 		void Update(int time);
391 		void Render();
OnMouseClick(int button)392 		bool OnMouseClick(int button) { ARX_UNUSED(button); return false; }
393 		CMenuElement * OnShortCut();
RenderMouseOver()394 		void RenderMouseOver() { }
395 		CMenuZone * IsMouseOver(const Vec2s & mousePos) const;
396 		CMenuZone * GetZoneWithID(int zoneId);
397 };
398 
399 class CMenuElementText: public CMenuElement {
400 
401 	public:
402 		std::string lpszText;
403 		Font*	pFont;
404 		Color lColor;
405 		Color lOldColor;
406 		Color lColorHighlight;
407 		float	fSize;
408 		bool	bSelected;
409 		int		iPosCursor;
410 
411 	public:
412 
413 		CMenuElementText(int id, Font * font, const std::string & text, float px, float py,
414 		                 Color color, float size, MENUSTATE state);
415 		virtual ~CMenuElementText();
416 
417 		CMenuElement * OnShortCut();
418 		bool OnMouseClick(int button);
419 		void Update(int time);
420 		void Render();
421 		void SetText(const std::string & _pText);
422 		void RenderMouseOver();
423 
424 		Vec2i GetTextSize() const;
425 
426 		bool OnMouseDoubleClick(int button);
427 };
428 
429 class CMenuButton: public CMenuElement {
430 
431 	public:
432 		std::string         vText;
433 		int                 iPos;
434 		TextureContainer*   pTex;
435 		TextureContainer*   pTexOver;
436 		Font*               pFont;
437 		int                 iColor;
438 		float               fSize;
439 
440 	public:
441 		CMenuButton(int id, Font * font, MENUSTATE state, int px, int py,
442 		            const std::string & label, float size = 1.f, TextureContainer * tex = NULL,
443 		            TextureContainer * texOver = NULL, int color = -1);
444 		~CMenuButton();
445 
446 	public:
447 		void SetPos(float px, float py);
448 		void AddText(const std::string & label);
OnShortCut()449 		CMenuElement * OnShortCut() { return NULL; }
450 		bool OnMouseClick(int button);
451 		void Update(int time);
452 		void Render();
453 		void RenderMouseOver();
454 };
455 
456 class CMenuSliderText: public CMenuElement {
457 	public:
458 		CMenuButton		*	pLeftButton;
459 		CMenuButton		*	pRightButton;
460 		std::vector<CMenuElementText*>	vText;
461 		int					iPos;
462 		int					iOldPos;
463 	public:
464 		CMenuSliderText(int, int, int);
465 		virtual ~CMenuSliderText();
466 
467 	public:
468 		void AddText(CMenuElementText * text);
469 
470 	public:
471 		void Move(int dx, int dy);
472 		bool OnMouseClick(int button);
OnShortCut()473 		CMenuElement * OnShortCut() { return NULL; }
474 		void Update(int time);
475 		void Render();
476 		void RenderMouseOver();
477 		void EmptyFunction();
478 		void SetWidth(int width);
479 		virtual void setEnabled(bool enable);
480 };
481 
482 //! Slider with value in the range [0..10]
483 class CMenuSlider: public CMenuElement {
484 
485 	public:
486 		CMenuButton		*	pLeftButton;
487 		CMenuButton		*	pRightButton;
488 		TextureContainer	* pTex1;
489 		TextureContainer	* pTex2;
490 		int					iPos;
491 
setValue(int value)492 		void setValue(int value) { iPos = value; }
getValue()493 		int getValue() const { return iPos; }
494 
495 	public:
496 		CMenuSlider(int id, int px, int py);
497 		virtual ~CMenuSlider();
498 
499 	public:
500 		void Move(int dx, int dy);
501 		bool OnMouseClick(int button);
OnShortCut()502 		CMenuElement * OnShortCut() { return NULL; }
503 		void Update(int time);
504 		void Render();
505 		void RenderMouseOver();
506 		void EmptyFunction();
507 };
508 
509 class CMenuCheckButton : public CMenuElement {
510 
511 	void ComputeTexturesPosition();
512 
513 	public:
514 		int					iState;
515 		int					iOldState;
516 		int					iPosX;
517 		int					iPosY;
518 		int					iTaille;
519 		CMenuAllZone	*	pAllCheckZone;
520 		std::vector<TextureContainer *> vTex;
521 		CMenuElementText	* pText;
522 
523 	public:
524 		CMenuCheckButton(int id, float px, float py, int size, TextureContainer * tex1,
525 		                 TextureContainer * tex2, CMenuElementText * label = NULL);
526 		virtual ~CMenuCheckButton();
527 
528 		void Move(int dx, int dy);
529 		bool OnMouseClick(int button);
530 		void Update(int time);
531 		void Render();
532 		void RenderMouseOver();
533 };
534 
535 class CMenuState {
536 
537 	public:
538 		bool					bReInitAll;
539 		MENUSTATE				eMenuState;
540 		MENUSTATE				eOldMenuState;
541 		MENUSTATE				eOldMenuWindowState;
542 		TextureContainer	*	pTexBackGround;
543 		TextureContainer	*	pTexBackGround1;
544 		CMenuAllZone		*	pMenuAllZone;
545 		CMenuElement		*	pZoneClick;
546 		float					fPos;
547 
548 		int						iPosMenu;
549 	public:
550 		explicit CMenuState(MENUSTATE state);
551 		virtual ~CMenuState();
552 
553 		void AddMenuElement(CMenuElement * element);
554 		MENUSTATE Update(int time);
555 		void Render();
556 };
557 
558 class CWindowMenuConsole {
559 
560 	public:
561 		bool					bMouseListen;
562 		bool					bFrameOdd;
563 
564 		int						iPosX;
565 		int						iPosY;
566 		int						iSavePosY;
567 		int						iOldPosX;
568 		int						iOldPosY;
569 		int						iOX;
570 		int						iOY;
571 		int						iWidth;
572 		int						iHeight;
573 		int						iInterligne;
574 		MENUSTATE				eMenuState;
575 		CMenuAllZone			MenuAllZone;
576 		CMenuElement		*	pZoneClick;
577 		bool					bEdit;
578 		TextureContainer	*	pTexBackground;
579 		TextureContainer	*	pTexBackgroundBorder;
580 
581 		long					lData;
582 		long			*		pData;
583 
584 		int						iPosMenu;
585 		bool				bMouseAttack;
586 	private:
587 		void UpdateText();
588 	public:
589 		CWindowMenuConsole(int px, int py, int width, int height, MENUSTATE state);
590 
591 		void AddMenu(CMenuElement * menu);
592 		void AddMenuCenter(CMenuElement * menu);
593 		void AddMenuCenterY(CMenuElement * menu);
594 		void AlignElementCenter(CMenuElement * element);
595 		MENUSTATE Update(int px, int py, int offsety);
596 		int Render();
597 
598 		CMenuElement * GetTouch(bool keyTouched, int keyId, InputKeyId* pInputKeyId = NULL, bool _bValidateTest = false);
599 		void ReInitActionKey();
600 };
601 
602 class CWindowMenu {
603 
604 	public:
605 		bool				bMouseListen;
606 		int					iPosX;
607 		int					iPosY;
608 		int					iNbButton;
609 		int					iTailleX;
610 		int					iTailleY;
611 		TextureContainer	* pTexButton;
612 		TextureContainer	* pTexButton2;
613 		TextureContainer	* pTexButton3;
614 		TextureContainer	* pTexMain;
615 		TextureContainer	* pTexMainShadow;
616 		TextureContainer	* pTexGlissiere;
617 		TextureContainer	* pTexGlissiereButton;
618 		std::vector<CWindowMenuConsole *>	vWindowConsoleElement;
619 		float				fPosXCalc;
620 		float				fDist;
621 		float				fAngle;
622 		MENUSTATE			eCurrentMenuState;
623 		bool				bChangeConsole;
624 	public:
625 		CWindowMenu(int px, int py, int width, int height, int nButton);
626 		virtual ~CWindowMenu();
627 
628 		void AddConsole(CWindowMenuConsole * console);
629 		void Update(float time);
630 		MENUSTATE Render();
631 };
632 
633 class MenuCursor {
634 
635 public:
636 
637 	enum CURSORSTATE {
638 		CURSOR_OFF,
639 		CURSOR_ON,
640 	};
641 
642 	MenuCursor();
643 	virtual ~MenuCursor();
644 
645 	void Update();
646 	void SetMouseOver();
647 	void SetCursorOn();
648 	void SetCursorOff();
649 	void DrawCursor();
650 
651 private:
652 
653 	void DrawOneCursor(const Vec2s & mousePos);
654 
655 	bool exited; //! Has the mouse exited the window
656 
657 	// Cursor
658 	TextureContainer	* pTex[8];
659 	long				lFrameDiff;
660 	CURSORSTATE			eNumTex;
661 	int					iNumCursor;
662 	float				fTailleX;
663 	float				fTailleY;
664 	bool				bMouseOver;
665 	bool				bDrawCursor;
666 
667 	// For the ribbon effect
668 	int					iNbOldCoord;
669 	int					iMaxOldCoord;
670 	Vec2s				iOldCoord[256];
671 
672 };
673 
674 bool Menu2_Render();
675 void Menu2_Close();
676 
677 bool ProcessFadeInOut(bool _bFadeIn, float _fspeed);
678 
679 void ARX_MENU_Clicked_NEWQUEST();
680 void ARX_MENU_Clicked_QUIT();
681 
682 bool ARX_QuickLoad();
683 void ARX_QuickSave();
684 void ARX_DrawAfterQuickLoad();
685 
686 #endif // ARX_GUI_MENUWIDGETS_H
687