C++11 cleanup on constructors guiEngine (#6036)

* C++11 cleanup on constructors guiEngine
master
Vincent Glize 2017-06-24 13:41:30 +02:00 committed by Loïc Blot
parent 8a84e89922
commit 9da5fb1583
2 changed files with 36 additions and 52 deletions

View File

@ -45,14 +45,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#endif #endif
/******************************************************************************/
/** TextDestGuiEngine */
/******************************************************************************/
TextDestGuiEngine::TextDestGuiEngine(GUIEngine* engine)
{
m_engine = engine;
}
/******************************************************************************/ /******************************************************************************/
void TextDestGuiEngine::gotText(const StringMap &fields) void TextDestGuiEngine::gotText(const StringMap &fields)
{ {
@ -65,14 +57,6 @@ void TextDestGuiEngine::gotText(const std::wstring &text)
m_engine->getScriptIface()->handleMainMenuEvent(wide_to_utf8(text)); m_engine->getScriptIface()->handleMainMenuEvent(wide_to_utf8(text));
} }
/******************************************************************************/
/** MenuTextureSource */
/******************************************************************************/
MenuTextureSource::MenuTextureSource(video::IVideoDriver *driver)
{
m_driver = driver;
}
/******************************************************************************/ /******************************************************************************/
MenuTextureSource::~MenuTextureSource() MenuTextureSource::~MenuTextureSource()
{ {
@ -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) if(id)
*id = 0; *id = 0;
@ -130,13 +114,13 @@ void MenuMusicFetcher::fetchSounds(const std::string &name,
/******************************************************************************/ /******************************************************************************/
/** GUIEngine */ /** GUIEngine */
/******************************************************************************/ /******************************************************************************/
GUIEngine::GUIEngine( irr::IrrlichtDevice* dev, GUIEngine::GUIEngine(irr::IrrlichtDevice *dev,
JoystickController *joystick, JoystickController *joystick,
gui::IGUIElement* parent, gui::IGUIElement *parent,
IMenuManager *menumgr, IMenuManager *menumgr,
scene::ISceneManager* smgr, scene::ISceneManager *smgr,
MainMenuData* data, MainMenuData *data,
bool& kill) : bool &kill) :
m_device(dev), m_device(dev),
m_parent(parent), m_parent(parent),
m_menumanager(menumgr), 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(); 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(); 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(); 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(); core::dimension2d<u32> screensize = driver->getScreenSize();

View File

@ -43,7 +43,7 @@ typedef enum {
} texture_layer; } texture_layer;
typedef struct { typedef struct {
video::ITexture* texture; video::ITexture *texture = nullptr;
bool tile; bool tile;
unsigned int minsize; unsigned int minsize;
} image_definition; } image_definition;
@ -68,7 +68,7 @@ public:
* default constructor * default constructor
* @param engine the engine data is transmitted for further processing * @param engine the engine data is transmitted for further processing
*/ */
TextDestGuiEngine(GUIEngine* engine); TextDestGuiEngine(GUIEngine* engine) : m_engine(engine) {};
/** /**
* receive fields transmitted by guiFormSpecMenu * receive fields transmitted by guiFormSpecMenu
@ -84,7 +84,7 @@ public:
private: private:
/** target to transmit data to */ /** target to transmit data to */
GUIEngine* m_engine; GUIEngine *m_engine = nullptr;
}; };
/** GUIEngine specific implementation of ISimpleTextureSource */ /** GUIEngine specific implementation of ISimpleTextureSource */
@ -95,7 +95,7 @@ public:
* default constructor * default constructor
* @param driver the video driver to load textures from * @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 * destructor, removes all loaded textures
@ -107,11 +107,11 @@ public:
* @param name path to the texture * @param name path to the texture
* @param id receives the texture ID, always 0 in this implementation * @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: private:
/** driver to get textures from */ /** driver to get textures from */
video::IVideoDriver *m_driver; video::IVideoDriver *m_driver = nullptr;
/** set of texture names to delete */ /** set of texture names to delete */
std::set<std::string> m_to_delete; std::set<std::string> m_to_delete;
}; };
@ -150,13 +150,13 @@ public:
* @param smgr scene manager to add scene elements to * @param smgr scene manager to add scene elements to
* @param data struct to transfer data to main game handling * @param data struct to transfer data to main game handling
*/ */
GUIEngine(irr::IrrlichtDevice* dev, GUIEngine(irr::IrrlichtDevice *dev,
JoystickController *joystick, JoystickController *joystick,
gui::IGUIElement* parent, gui::IGUIElement *parent,
IMenuManager *menumgr, IMenuManager *menumgr,
scene::ISceneManager* smgr, scene::ISceneManager *smgr,
MainMenuData* data, MainMenuData *data,
bool& kill); bool &kill);
/** default destructor */ /** default destructor */
virtual ~GUIEngine(); virtual ~GUIEngine();
@ -164,7 +164,7 @@ public:
/** /**
* return MainMenuScripting interface * return MainMenuScripting interface
*/ */
MainMenuScripting* getScriptIface() MainMenuScripting *getScriptIface()
{ {
return m_script; return m_script;
} }
@ -193,15 +193,15 @@ private:
void updateTopLeftTextSize(); void updateTopLeftTextSize();
/** device to draw at */ /** device to draw at */
irr::IrrlichtDevice* m_device; irr::IrrlichtDevice *m_device = nullptr;
/** parent gui element */ /** parent gui element */
gui::IGUIElement* m_parent; gui::IGUIElement *m_parent = nullptr;
/** manager to add menus to */ /** manager to add menus to */
IMenuManager* m_menumanager; IMenuManager *m_menumanager = nullptr;
/** scene manager to add scene elements to */ /** 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 */ /** pointer to data beeing transfered back to main game handling */
MainMenuData* m_data; MainMenuData *m_data = nullptr;
/** pointer to texture source */ /** pointer to texture source */
ISimpleTextureSource *m_texture_source = nullptr; ISimpleTextureSource *m_texture_source = nullptr;
/** pointer to soundmanager*/ /** pointer to soundmanager*/
@ -215,7 +215,7 @@ private:
GUIFormSpecMenu *m_menu = nullptr; GUIFormSpecMenu *m_menu = nullptr;
/** reference to kill variable managed by SIGINT handler */ /** 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 */ /** variable used to abort menu and return back to main game handling */
bool m_startgame = false; bool m_startgame = false;
@ -230,22 +230,22 @@ private:
* draw background layer * draw background layer
* @param driver to use for drawing * @param driver to use for drawing
*/ */
void drawBackground(video::IVideoDriver* driver); void drawBackground(video::IVideoDriver *driver);
/** /**
* draw overlay layer * draw overlay layer
* @param driver to use for drawing * @param driver to use for drawing
*/ */
void drawOverlay(video::IVideoDriver* driver); void drawOverlay(video::IVideoDriver *driver);
/** /**
* draw header layer * draw header layer
* @param driver to use for drawing * @param driver to use for drawing
*/ */
void drawHeader(video::IVideoDriver* driver); void drawHeader(video::IVideoDriver *driver);
/** /**
* draw footer layer * draw footer layer
* @param driver to use for drawing * @param driver to use for drawing
*/ */
void drawFooter(video::IVideoDriver* driver); void drawFooter(video::IVideoDriver *driver);
/** /**
* load a texture for a specified layer * load a texture for a specified layer
@ -290,9 +290,9 @@ private:
/** absolute time of last cloud processing */ /** absolute time of last cloud processing */
u32 lasttime; u32 lasttime;
/** pointer to cloud class */ /** pointer to cloud class */
Clouds* clouds; Clouds *clouds = nullptr;
/** camera required for drawing clouds */ /** camera required for drawing clouds */
scene::ICameraSceneNode* camera; scene::ICameraSceneNode *camera = nullptr;
}; };
/** is drawing of clouds enabled atm */ /** is drawing of clouds enabled atm */