Remove unused parameter of GUIVolumeChange

master
Rui 2016-10-09 17:27:14 +09:00 committed by Ner'zhul
parent 569b89b36f
commit b3fc133442
3 changed files with 37 additions and 50 deletions

View File

@ -2571,7 +2571,7 @@ inline bool Game::handleCallbacks()
if (g_gamecallback->changevolume_requested) { if (g_gamecallback->changevolume_requested) {
(new GUIVolumeChange(guienv, guiroot, -1, (new GUIVolumeChange(guienv, guiroot, -1,
&g_menumgr, client))->drop(); &g_menumgr))->drop();
g_gamecallback->changevolume_requested = false; g_gamecallback->changevolume_requested = false;
} }

View File

@ -37,8 +37,7 @@ const int ID_soundSlider = 266;
GUIVolumeChange::GUIVolumeChange(gui::IGUIEnvironment* env, GUIVolumeChange::GUIVolumeChange(gui::IGUIEnvironment* env,
gui::IGUIElement* parent, s32 id, gui::IGUIElement* parent, s32 id,
IMenuManager *menumgr, IMenuManager *menumgr
Client* client
): ):
GUIModalMenu(env, parent, id, menumgr) GUIModalMenu(env, parent, id, menumgr)
{ {
@ -51,26 +50,17 @@ GUIVolumeChange::~GUIVolumeChange()
void GUIVolumeChange::removeChildren() void GUIVolumeChange::removeChildren()
{ {
{ if (gui::IGUIElement *e = getElementFromId(ID_soundText1))
gui::IGUIElement *e = getElementFromId(ID_soundText1); e->remove();
if(e != NULL)
e->remove(); if (gui::IGUIElement *e = getElementFromId(ID_soundText2))
} e->remove();
{
gui::IGUIElement *e = getElementFromId(ID_soundText2); if (gui::IGUIElement *e = getElementFromId(ID_soundExitButton))
if(e != NULL) e->remove();
e->remove();
} if (gui::IGUIElement *e = getElementFromId(ID_soundSlider))
{ e->remove();
gui::IGUIElement *e = getElementFromId(ID_soundExitButton);
if(e != NULL)
e->remove();
}
{
gui::IGUIElement *e = getElementFromId(ID_soundSlider);
if(e != NULL)
e->remove();
}
} }
void GUIVolumeChange::regenerateGui(v2u32 screensize) void GUIVolumeChange::regenerateGui(v2u32 screensize)
@ -95,7 +85,7 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize)
v2s32 size = rect.getSize(); v2s32 size = rect.getSize();
v2s32 topleft_client(40, 0); v2s32 topleft_client(40, 0);
int volume=(int)(g_settings->getFloat("sound_volume")*100); int volume = (int)(g_settings->getFloat("sound_volume")*100);
/* /*
Add stuff Add stuff
*/ */
@ -137,45 +127,43 @@ void GUIVolumeChange::drawMenu()
if (!skin) if (!skin)
return; return;
video::IVideoDriver* driver = Environment->getVideoDriver(); video::IVideoDriver* driver = Environment->getVideoDriver();
video::SColor bgcolor(140,0,0,0); video::SColor bgcolor(140, 0, 0, 0);
driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect); driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect);
gui::IGUIElement::draw(); gui::IGUIElement::draw();
} }
bool GUIVolumeChange::OnEvent(const SEvent& event) bool GUIVolumeChange::OnEvent(const SEvent& event)
{ {
if(event.EventType==EET_KEY_INPUT_EVENT) if (event.EventType == EET_KEY_INPUT_EVENT) {
{ if (event.KeyInput.Key == KEY_ESCAPE && event.KeyInput.PressedDown) {
if(event.KeyInput.Key==KEY_ESCAPE && event.KeyInput.PressedDown)
{
quitMenu(); quitMenu();
return true; return true;
} }
if(event.KeyInput.Key==KEY_RETURN && event.KeyInput.PressedDown)
{ if (event.KeyInput.Key == KEY_RETURN && event.KeyInput.PressedDown) {
quitMenu(); quitMenu();
return true; return true;
} }
} }
if(event.GUIEvent.EventType==gui::EGET_BUTTON_CLICKED)
{ if (event.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED) {
if (event.GUIEvent.Caller->getID() == ID_soundExitButton) if (event.GUIEvent.Caller->getID() == ID_soundExitButton) {
{ quitMenu();
quitMenu(); return true;
return true;
}
} }
if(event.GUIEvent.EventType==gui::EGET_SCROLL_BAR_CHANGED) }
{
if (event.GUIEvent.Caller->getID() == ID_soundSlider) if (event.GUIEvent.EventType == gui::EGET_SCROLL_BAR_CHANGED) {
{ if (event.GUIEvent.Caller->getID() == ID_soundSlider) {
s32 pos = ((gui::IGUIScrollBar*)event.GUIEvent.Caller)->getPos(); s32 pos = ((gui::IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
g_settings->setFloat("sound_volume",(float)pos/100); g_settings->setFloat("sound_volume", (float)pos/100);
gui::IGUIElement *e = getElementFromId(ID_soundText2);
e->setText( core::stringw(pos).c_str() ); gui::IGUIElement *e = getElementFromId(ID_soundText2);
return true; e->setText(core::stringw(pos).c_str());
} return true;
} }
}
return Parent ? Parent->OnEvent(event) : false; return Parent ? Parent->OnEvent(event) : false;
} }

View File

@ -30,8 +30,7 @@ class GUIVolumeChange : public GUIModalMenu
public: public:
GUIVolumeChange(gui::IGUIEnvironment* env, GUIVolumeChange(gui::IGUIEnvironment* env,
gui::IGUIElement* parent, s32 id, gui::IGUIElement* parent, s32 id,
IMenuManager *menumgr, IMenuManager *menumgr);
Client* client);
~GUIVolumeChange(); ~GUIVolumeChange();
void removeChildren(); void removeChildren();