Skip to content

Commit

Permalink
C++11 cleanup on constructors guiEngine (#6036)
Browse files Browse the repository at this point in the history
* C++11 cleanup on constructors guiEngine
  • Loading branch information
Dumbeldor authored and nerzhul committed Jun 24, 2017
1 parent 8a84e89 commit 9da5fb1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 52 deletions.
40 changes: 12 additions & 28 deletions src/guiEngine.cpp
Expand Up @@ -45,14 +45,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#endif


/******************************************************************************/
/** TextDestGuiEngine */
/******************************************************************************/
TextDestGuiEngine::TextDestGuiEngine(GUIEngine* engine)
{
m_engine = engine;
}

/******************************************************************************/
void TextDestGuiEngine::gotText(const StringMap &fields)
{
Expand All @@ -65,14 +57,6 @@ void TextDestGuiEngine::gotText(const std::wstring &text)
m_engine->getScriptIface()->handleMainMenuEvent(wide_to_utf8(text));
}

/******************************************************************************/
/** MenuTextureSource */
/******************************************************************************/
MenuTextureSource::MenuTextureSource(video::IVideoDriver *driver)
{
m_driver = driver;
}

/******************************************************************************/
MenuTextureSource::~MenuTextureSource()
{
Expand All @@ -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;
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -388,7 +372,7 @@ void GUIEngine::cloudPostProcess()
}

/******************************************************************************/
void GUIEngine::drawBackground(video::IVideoDriver* driver)
void GUIEngine::drawBackground(video::IVideoDriver *driver)
{
v2u32 screensize = driver->getScreenSize();

Expand Down Expand Up @@ -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();

Expand All @@ -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();

Expand Down Expand Up @@ -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();

Expand Down
48 changes: 24 additions & 24 deletions src/guiEngine.h
Expand Up @@ -43,7 +43,7 @@ typedef enum {
} texture_layer;

typedef struct {
video::ITexture* texture;
video::ITexture *texture = nullptr;
bool tile;
unsigned int minsize;
} image_definition;
Expand All @@ -68,7 +68,7 @@ class TextDestGuiEngine : public TextDest
* 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
Expand All @@ -84,7 +84,7 @@ class TextDestGuiEngine : public TextDest

private:
/** target to transmit data to */
GUIEngine* m_engine;
GUIEngine *m_engine = nullptr;
};

/** GUIEngine specific implementation of ISimpleTextureSource */
Expand All @@ -95,7 +95,7 @@ class MenuTextureSource : public ISimpleTextureSource
* 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
Expand All @@ -107,11 +107,11 @@ class MenuTextureSource : public ISimpleTextureSource
* @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;
};
Expand Down Expand Up @@ -150,21 +150,21 @@ class GUIEngine {
* @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();

/**
* return MainMenuScripting interface
*/
MainMenuScripting* getScriptIface()
MainMenuScripting *getScriptIface()
{
return m_script;
}
Expand Down Expand Up @@ -193,15 +193,15 @@ class GUIEngine {
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*/
Expand All @@ -215,7 +215,7 @@ class GUIEngine {
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;
Expand All @@ -230,22 +230,22 @@ class GUIEngine {
* 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
Expand Down Expand Up @@ -290,9 +290,9 @@ class GUIEngine {
/** 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 */
Expand Down

0 comments on commit 9da5fb1

Please sign in to comment.