3 Copyright (C) 2010 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 General Public License as published by
7 the Free Software Foundation; either version 2 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 General Public License for more details.
15 You should have received a copy of the GNU 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
30 extern gui::IGUIEnvironment* guienv;
31 extern gui::IGUIStaticText *guiroot;
33 // Handler for the modal menus
35 class MainMenuManager : public IMenuManager
38 virtual void createdMenu(GUIModalMenu *menu)
40 for(core::list<GUIModalMenu*>::Iterator
42 i != m_stack.end(); i++)
47 if(m_stack.size() != 0)
48 (*m_stack.getLast())->setVisible(false);
49 m_stack.push_back(menu);
52 virtual void deletingMenu(GUIModalMenu *menu)
54 // Remove all entries if there are duplicates
57 removed_entry = false;
58 for(core::list<GUIModalMenu*>::Iterator
60 i != m_stack.end(); i++)
69 }while(removed_entry);
71 /*core::list<GUIModalMenu*>::Iterator i = m_stack.getLast();
75 if(m_stack.size() != 0)
76 (*m_stack.getLast())->setVisible(true);
81 return m_stack.size();
84 core::list<GUIModalMenu*> m_stack;
87 extern MainMenuManager g_menumgr;
89 extern bool noMenuActive();
91 class MainGameCallback : public IGameCallback
94 MainGameCallback(IrrlichtDevice *a_device):
95 disconnect_requested(false),
96 changepassword_requested(false),
101 virtual void exitToOS()
103 device->closeDevice();
106 virtual void disconnect()
108 disconnect_requested = true;
111 virtual void changePassword()
113 changepassword_requested = true;
116 bool disconnect_requested;
117 bool changepassword_requested;
118 IrrlichtDevice *device;
121 extern MainGameCallback *g_gamecallback;