1 #pragma once
2 // Description:
3 //   Menu Manager/Controller.
4 //
5 // Copyright (C) 2001 Frank Becker
6 //
7 // This program is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU General Public License as published by the Free Software
9 // Foundation;  either version 2 of the License,  or (at your option) any  later
10 // version.
11 //
12 // This program is distributed in the hope that it will be useful,  but  WITHOUT
13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
15 //
16 
17 #include <list>
18 
19 #include <Singleton.hpp>
20 #include <tinyxml.h>
21 
22 #include <InterceptorI.hpp>
23 #include <Context.hpp>
24 #include <Model.hpp>
25 #include <ParticleGroup.hpp>
26 #include <OnlineUpdateDisplay.hpp>
27 
28 class Selectable;
29 class GLTextureCubeMap;
30 
31 class MenuManager: public InterceptorI
32 {
33 friend class Singleton<MenuManager>;
34 public:
35     bool init( void);
36     bool update( void);
37     bool draw( void);
38 
39     virtual void input( const Trigger &trigger, const bool &isDown);
40     void turnMenuOn( void);
41     void turnMenuOff( void);
42     void makeMenu( TiXmlNode *_node);
43 
44     //Menu navigation
45     void Down( void);
46     void Up( void);
47     void Enter( void);
48     bool Exit( bool delayed=false);
49     void Goto( Selectable *s);
50 
51     void reload( void);
52 
53 private:
54     virtual ~MenuManager();
55     MenuManager( void);
56     MenuManager( const MenuManager&);
57     MenuManager &operator=(const MenuManager&);
58 
59     void loadMenuLevel( void);
60     void clearActiveSelectables( void);
61     void updateSettings( void);
62     void activateSelectableUnderMouse( void);
63 
64     TiXmlDocument *_menu;
65 
66     TiXmlNode *_topMenu;
67     TiXmlNode *_currentMenu;
68 
69     std::list<Selectable*> _activeSelectables;
70     std::list<Selectable*>::iterator _currentSelectable;
71 
72     int _board;
73     Point2Di _boardOffset;
74 
75     int _pointer;
76 
77     float _prevMouseX;
78     float _prevMouseY;
79     float _mouseX;
80     float _mouseY;
81 
82     Context::ContextEnum _prevContext;
83     bool _delayedExit;
84     bool _newLevelLoaded;
85 
86     Model *_nextGenShippy;
87     Model *_mapleLeaf;
88     float _angle;
89     float _prevAngle;
90 
91     bool _showSparks;
92     ParticleGroup _burst;
93 #ifdef USE_ONLINE_UPDATE
94     OnlineUpdateDisplay _onlineUpdateDisplay;
95 #endif
96     GLTextureCubeMap *_nextGenShippyCubeMap;
97 };
98 
99 typedef Singleton<MenuManager> MenuManagerS;
100