aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/src/main.h b/src/main.h
index 4248bd3e4..c8ac7ccf1 100644
--- a/src/main.h
+++ b/src/main.h
@@ -46,5 +46,98 @@ extern std::ostream *derr_server_ptr;
#define dout_server (*dout_server_ptr)
#define derr_server (*derr_server_ptr)
+/*
+ All kinds of stuff that needs to be exposed from main.cpp
+*/
+
+#include "modalMenu.h"
+#include "guiPauseMenu.h" //For IGameCallback
+
+extern gui::IGUIEnvironment* guienv;
+extern gui::IGUIStaticText *guiroot;
+
+// Handler for the modal menus
+
+class MainMenuManager : public IMenuManager
+{
+public:
+ virtual void createdMenu(GUIModalMenu *menu)
+ {
+ for(core::list<GUIModalMenu*>::Iterator
+ i = m_stack.begin();
+ i != m_stack.end(); i++)
+ {
+ assert(*i != menu);
+ }
+
+ if(m_stack.size() != 0)
+ (*m_stack.getLast())->setVisible(false);
+ m_stack.push_back(menu);
+ }
+
+ virtual void deletingMenu(GUIModalMenu *menu)
+ {
+ // Remove all entries if there are duplicates
+ bool removed_entry;
+ do{
+ removed_entry = false;
+ for(core::list<GUIModalMenu*>::Iterator
+ i = m_stack.begin();
+ i != m_stack.end(); i++)
+ {
+ if(*i == menu)
+ {
+ m_stack.erase(i);
+ removed_entry = true;
+ break;
+ }
+ }
+ }while(removed_entry);
+
+ /*core::list<GUIModalMenu*>::Iterator i = m_stack.getLast();
+ assert(*i == menu);
+ m_stack.erase(i);*/
+
+ if(m_stack.size() != 0)
+ (*m_stack.getLast())->setVisible(true);
+ }
+
+ u32 menuCount()
+ {
+ return m_stack.size();
+ }
+
+ core::list<GUIModalMenu*> m_stack;
+};
+
+extern MainMenuManager g_menumgr;
+
+extern bool noMenuActive();
+
+class MainGameCallback : public IGameCallback
+{
+public:
+ MainGameCallback(IrrlichtDevice *a_device):
+ disconnect_requested(false),
+ device(a_device)
+ {
+ }
+
+ virtual void exitToOS()
+ {
+ device->closeDevice();
+ }
+
+ virtual void disconnect()
+ {
+ disconnect_requested = true;
+ }
+
+ bool disconnect_requested;
+ IrrlichtDevice *device;
+};
+
+extern MainGameCallback *g_gamecallback;
+
#endif