3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef MAINMENUMANAGER_HEADER
21 #define MAINMENUMANAGER_HEADER
24 All kinds of stuff that needs to be exposed from main.cpp
26 #include "debug.h" // assert
27 #include "modalMenu.h"
28 #include "guiPauseMenu.h" //For IGameCallback
31 extern gui::IGUIEnvironment* guienv;
32 extern gui::IGUIStaticText *guiroot;
34 // Handler for the modal menus
36 class MainMenuManager : public IMenuManager
39 virtual void createdMenu(GUIModalMenu *menu)
41 for(std::list<GUIModalMenu*>::iterator
43 i != m_stack.end(); ++i)
48 if(m_stack.size() != 0)
49 m_stack.back()->setVisible(false);
50 m_stack.push_back(menu);
53 virtual void deletingMenu(GUIModalMenu *menu)
55 // Remove all entries if there are duplicates
58 removed_entry = false;
59 for(std::list<GUIModalMenu*>::iterator
61 i != m_stack.end(); ++i)
70 }while(removed_entry);
72 /*core::list<GUIModalMenu*>::Iterator i = m_stack.getLast();
76 if(m_stack.size() != 0)
77 m_stack.back()->setVisible(true);
80 // Returns true to prevent further processing
81 virtual bool preprocessEvent(const SEvent& event)
83 if(m_stack.size() != 0)
84 return m_stack.back()->preprocessEvent(event);
91 return m_stack.size();
94 std::list<GUIModalMenu*> m_stack;
97 extern MainMenuManager g_menumgr;
99 extern bool noMenuActive();
101 class MainGameCallback : public IGameCallback
104 MainGameCallback(IrrlichtDevice *a_device):
105 disconnect_requested(false),
106 changepassword_requested(false),
107 changevolume_requested(false),
112 virtual void exitToOS()
114 device->closeDevice();
117 virtual void disconnect()
119 disconnect_requested = true;
122 virtual void changePassword()
124 changepassword_requested = true;
127 virtual void changeVolume()
129 changevolume_requested = true;
132 bool disconnect_requested;
133 bool changepassword_requested;
134 bool changevolume_requested;
135 IrrlichtDevice *device;
138 extern MainGameCallback *g_gamecallback;