diff options
author | Vincent Glize <vincentglize@hotmail.fr> | 2017-06-24 13:41:30 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-06-24 13:41:30 +0200 |
commit | 9da5fb1583211b44afa4d28f3ccb64d768c56771 (patch) | |
tree | 3cffe26d96c4917202ff44a37d1d1ac199fd50d7 | |
parent | 8a84e8992231e934c1276ba9b43a9eeaa7184b59 (diff) | |
download | minetest-9da5fb1583211b44afa4d28f3ccb64d768c56771.tar.gz minetest-9da5fb1583211b44afa4d28f3ccb64d768c56771.tar.bz2 minetest-9da5fb1583211b44afa4d28f3ccb64d768c56771.zip |
C++11 cleanup on constructors guiEngine (#6036)
* C++11 cleanup on constructors guiEngine
-rw-r--r-- | src/guiEngine.cpp | 40 | ||||
-rw-r--r-- | src/guiEngine.h | 48 |
2 files changed, 36 insertions, 52 deletions
diff --git a/src/guiEngine.cpp b/src/guiEngine.cpp index 0abb24792..d4b98c1c9 100644 --- a/src/guiEngine.cpp +++ b/src/guiEngine.cpp @@ -46,14 +46,6 @@ with this program; if not, write to the Free Software Foundation, Inc., /******************************************************************************/ -/** TextDestGuiEngine */ -/******************************************************************************/ -TextDestGuiEngine::TextDestGuiEngine(GUIEngine* engine) -{ - m_engine = engine; -} - -/******************************************************************************/ void TextDestGuiEngine::gotText(const StringMap &fields) { m_engine->getScriptIface()->handleMainMenuButtons(fields); @@ -66,14 +58,6 @@ void TextDestGuiEngine::gotText(const std::wstring &text) } /******************************************************************************/ -/** MenuTextureSource */ -/******************************************************************************/ -MenuTextureSource::MenuTextureSource(video::IVideoDriver *driver) -{ - m_driver = driver; -} - -/******************************************************************************/ MenuTextureSource::~MenuTextureSource() { for (std::set<std::string>::iterator it = m_to_delete.begin(); @@ -85,7 +69,7 @@ MenuTextureSource::~MenuTextureSource() } /******************************************************************************/ -video::ITexture* MenuTextureSource::getTexture(const std::string &name, u32 *id) +video::ITexture *MenuTextureSource::getTexture(const std::string &name, u32 *id) { if(id) *id = 0; @@ -130,13 +114,13 @@ void MenuMusicFetcher::fetchSounds(const std::string &name, /******************************************************************************/ /** GUIEngine */ /******************************************************************************/ -GUIEngine::GUIEngine( irr::IrrlichtDevice* dev, - JoystickController *joystick, - gui::IGUIElement* parent, - IMenuManager *menumgr, - scene::ISceneManager* smgr, - MainMenuData* data, - bool& kill) : +GUIEngine::GUIEngine(irr::IrrlichtDevice *dev, + JoystickController *joystick, + gui::IGUIElement *parent, + IMenuManager *menumgr, + scene::ISceneManager *smgr, + MainMenuData *data, + bool &kill) : m_device(dev), m_parent(parent), m_menumanager(menumgr), @@ -388,7 +372,7 @@ void GUIEngine::cloudPostProcess() } /******************************************************************************/ -void GUIEngine::drawBackground(video::IVideoDriver* driver) +void GUIEngine::drawBackground(video::IVideoDriver *driver) { v2u32 screensize = driver->getScreenSize(); @@ -430,7 +414,7 @@ void GUIEngine::drawBackground(video::IVideoDriver* driver) } /******************************************************************************/ -void GUIEngine::drawOverlay(video::IVideoDriver* driver) +void GUIEngine::drawOverlay(video::IVideoDriver *driver) { v2u32 screensize = driver->getScreenSize(); @@ -449,7 +433,7 @@ void GUIEngine::drawOverlay(video::IVideoDriver* driver) } /******************************************************************************/ -void GUIEngine::drawHeader(video::IVideoDriver* driver) +void GUIEngine::drawHeader(video::IVideoDriver *driver) { core::dimension2d<u32> screensize = driver->getScreenSize(); @@ -483,7 +467,7 @@ void GUIEngine::drawHeader(video::IVideoDriver* driver) } /******************************************************************************/ -void GUIEngine::drawFooter(video::IVideoDriver* driver) +void GUIEngine::drawFooter(video::IVideoDriver *driver) { core::dimension2d<u32> screensize = driver->getScreenSize(); diff --git a/src/guiEngine.h b/src/guiEngine.h index e6cea6b4f..cf2bade70 100644 --- a/src/guiEngine.h +++ b/src/guiEngine.h @@ -43,7 +43,7 @@ typedef enum { } texture_layer; typedef struct { - video::ITexture* texture; + video::ITexture *texture = nullptr; bool tile; unsigned int minsize; } image_definition; @@ -68,7 +68,7 @@ public: * default constructor * @param engine the engine data is transmitted for further processing */ - TextDestGuiEngine(GUIEngine* engine); + TextDestGuiEngine(GUIEngine* engine) : m_engine(engine) {}; /** * receive fields transmitted by guiFormSpecMenu @@ -84,7 +84,7 @@ public: private: /** target to transmit data to */ - GUIEngine* m_engine; + GUIEngine *m_engine = nullptr; }; /** GUIEngine specific implementation of ISimpleTextureSource */ @@ -95,7 +95,7 @@ public: * default constructor * @param driver the video driver to load textures from */ - MenuTextureSource(video::IVideoDriver *driver); + MenuTextureSource(video::IVideoDriver *driver) : m_driver(driver) {}; /** * destructor, removes all loaded textures @@ -107,11 +107,11 @@ public: * @param name path to the texture * @param id receives the texture ID, always 0 in this implementation */ - video::ITexture* getTexture(const std::string &name, u32 *id = NULL); + video::ITexture *getTexture(const std::string &name, u32 *id = NULL); private: /** driver to get textures from */ - video::IVideoDriver *m_driver; + video::IVideoDriver *m_driver = nullptr; /** set of texture names to delete */ std::set<std::string> m_to_delete; }; @@ -150,13 +150,13 @@ public: * @param smgr scene manager to add scene elements to * @param data struct to transfer data to main game handling */ - GUIEngine(irr::IrrlichtDevice* dev, + GUIEngine(irr::IrrlichtDevice *dev, JoystickController *joystick, - gui::IGUIElement* parent, + gui::IGUIElement *parent, IMenuManager *menumgr, - scene::ISceneManager* smgr, - MainMenuData* data, - bool& kill); + scene::ISceneManager *smgr, + MainMenuData *data, + bool &kill); /** default destructor */ virtual ~GUIEngine(); @@ -164,7 +164,7 @@ public: /** * return MainMenuScripting interface */ - MainMenuScripting* getScriptIface() + MainMenuScripting *getScriptIface() { return m_script; } @@ -193,15 +193,15 @@ private: void updateTopLeftTextSize(); /** device to draw at */ - irr::IrrlichtDevice* m_device; + irr::IrrlichtDevice *m_device = nullptr; /** parent gui element */ - gui::IGUIElement* m_parent; + gui::IGUIElement *m_parent = nullptr; /** manager to add menus to */ - IMenuManager* m_menumanager; + IMenuManager *m_menumanager = nullptr; /** scene manager to add scene elements to */ - scene::ISceneManager* m_smgr; + scene::ISceneManager *m_smgr = nullptr; /** pointer to data beeing transfered back to main game handling */ - MainMenuData* m_data; + MainMenuData *m_data = nullptr; /** pointer to texture source */ ISimpleTextureSource *m_texture_source = nullptr; /** pointer to soundmanager*/ @@ -215,7 +215,7 @@ private: GUIFormSpecMenu *m_menu = nullptr; /** reference to kill variable managed by SIGINT handler */ - bool& m_kill; + bool &m_kill; /** variable used to abort menu and return back to main game handling */ bool m_startgame = false; @@ -230,22 +230,22 @@ private: * draw background layer * @param driver to use for drawing */ - void drawBackground(video::IVideoDriver* driver); + void drawBackground(video::IVideoDriver *driver); /** * draw overlay layer * @param driver to use for drawing */ - void drawOverlay(video::IVideoDriver* driver); + void drawOverlay(video::IVideoDriver *driver); /** * draw header layer * @param driver to use for drawing */ - void drawHeader(video::IVideoDriver* driver); + void drawHeader(video::IVideoDriver *driver); /** * draw footer layer * @param driver to use for drawing */ - void drawFooter(video::IVideoDriver* driver); + void drawFooter(video::IVideoDriver *driver); /** * load a texture for a specified layer @@ -290,9 +290,9 @@ private: /** absolute time of last cloud processing */ u32 lasttime; /** pointer to cloud class */ - Clouds* clouds; + Clouds *clouds = nullptr; /** camera required for drawing clouds */ - scene::ICameraSceneNode* camera; + scene::ICameraSceneNode *camera = nullptr; }; /** is drawing of clouds enabled atm */ |