51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MAINMENUMANAGER_HEADER
-#define MAINMENUMANAGER_HEADER
+#pragma once
/*
All kinds of stuff that needs to be exposed from main.cpp
*/
-#include "debug.h" // assert
#include "modalMenu.h"
+#include <cassert>
#include <list>
class IGameCallback
public:
virtual void createdMenu(gui::IGUIElement *menu)
{
- for(std::list<gui::IGUIElement*>::iterator
- i = m_stack.begin();
- i != m_stack.end(); ++i)
- {
- assert(*i != menu);
+#ifndef NDEBUG
+ for (gui::IGUIElement *i : m_stack) {
+ assert(i != menu);
}
+#endif
if(!m_stack.empty())
m_stack.back()->setVisible(false);
bool pausesGame()
{
- for(std::list<gui::IGUIElement*>::iterator
- i = m_stack.begin(); i != m_stack.end(); ++i)
- {
- GUIModalMenu *mm = dynamic_cast<GUIModalMenu*>(*i);
+ for (gui::IGUIElement *i : m_stack) {
+ GUIModalMenu *mm = dynamic_cast<GUIModalMenu*>(i);
if (mm && mm->pausesGame())
return true;
}
class MainGameCallback : public IGameCallback
{
public:
- MainGameCallback(IrrlichtDevice *a_device):
- device(a_device)
- {
- }
+ MainGameCallback() = default;
+ virtual ~MainGameCallback() = default;
virtual void exitToOS()
{
shutdown_requested = true;
-#ifndef __ANDROID__
- device->closeDevice();
-#endif
}
virtual void disconnect()
bool shutdown_requested = false;
bool keyconfig_changed = false;
-
- IrrlichtDevice *device;
};
extern MainGameCallback *g_gamecallback;
-
-#endif
-