aboutsummaryrefslogtreecommitdiff
path: root/src/guiVolumeChange.cpp
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2016-12-22 23:16:00 +0100
committerest31 <MTest31@outlook.com>2016-12-22 23:16:00 +0100
commit81d56b94919dceb7b2e51d70b21a7ca22f852bd5 (patch)
tree1e9ef1be1b3295a8673d6e4f0bdeb4c2d3a6015f /src/guiVolumeChange.cpp
parent8077612dcb48221281e726a60eb97bf73fde462b (diff)
parent231ac33d34dfaaddf292c5f31b1eae43eeefba2d (diff)
downloadminetest-81d56b94919dceb7b2e51d70b21a7ca22f852bd5.tar.gz
minetest-81d56b94919dceb7b2e51d70b21a7ca22f852bd5.tar.bz2
minetest-81d56b94919dceb7b2e51d70b21a7ca22f852bd5.zip
Merge 0.4.15 changes into stable-0.4
0.4.15 release!
Diffstat (limited to 'src/guiVolumeChange.cpp')
-rw-r--r--src/guiVolumeChange.cpp82
1 files changed, 35 insertions, 47 deletions
diff --git a/src/guiVolumeChange.cpp b/src/guiVolumeChange.cpp
index c8e257f7f..8425bc04f 100644
--- a/src/guiVolumeChange.cpp
+++ b/src/guiVolumeChange.cpp
@@ -37,8 +37,7 @@ const int ID_soundSlider = 266;
GUIVolumeChange::GUIVolumeChange(gui::IGUIEnvironment* env,
gui::IGUIElement* parent, s32 id,
- IMenuManager *menumgr,
- Client* client
+ IMenuManager *menumgr
):
GUIModalMenu(env, parent, id, menumgr)
{
@@ -51,26 +50,17 @@ GUIVolumeChange::~GUIVolumeChange()
void GUIVolumeChange::removeChildren()
{
- {
- gui::IGUIElement *e = getElementFromId(ID_soundText1);
- if(e != NULL)
- e->remove();
- }
- {
- gui::IGUIElement *e = getElementFromId(ID_soundText2);
- if(e != NULL)
- e->remove();
- }
- {
- gui::IGUIElement *e = getElementFromId(ID_soundExitButton);
- if(e != NULL)
- e->remove();
- }
- {
- gui::IGUIElement *e = getElementFromId(ID_soundSlider);
- if(e != NULL)
- e->remove();
- }
+ if (gui::IGUIElement *e = getElementFromId(ID_soundText1))
+ e->remove();
+
+ if (gui::IGUIElement *e = getElementFromId(ID_soundText2))
+ e->remove();
+
+ if (gui::IGUIElement *e = getElementFromId(ID_soundExitButton))
+ e->remove();
+
+ if (gui::IGUIElement *e = getElementFromId(ID_soundSlider))
+ e->remove();
}
void GUIVolumeChange::regenerateGui(v2u32 screensize)
@@ -95,7 +85,7 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize)
v2s32 size = rect.getSize();
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
*/
@@ -137,45 +127,43 @@ void GUIVolumeChange::drawMenu()
if (!skin)
return;
video::IVideoDriver* driver = Environment->getVideoDriver();
- video::SColor bgcolor(140,0,0,0);
+ video::SColor bgcolor(140, 0, 0, 0);
driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect);
gui::IGUIElement::draw();
}
bool GUIVolumeChange::OnEvent(const SEvent& event)
{
- if(event.EventType==EET_KEY_INPUT_EVENT)
- {
- if(event.KeyInput.Key==KEY_ESCAPE && event.KeyInput.PressedDown)
- {
+ if (event.EventType == EET_KEY_INPUT_EVENT) {
+ if (event.KeyInput.Key == KEY_ESCAPE && event.KeyInput.PressedDown) {
quitMenu();
return true;
}
- if(event.KeyInput.Key==KEY_RETURN && event.KeyInput.PressedDown)
- {
+
+ if (event.KeyInput.Key == KEY_RETURN && event.KeyInput.PressedDown) {
quitMenu();
return true;
}
}
- if(event.GUIEvent.EventType==gui::EGET_BUTTON_CLICKED)
- {
- if (event.GUIEvent.Caller->getID() == ID_soundExitButton)
- {
- quitMenu();
- return true;
- }
+
+ if (event.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED) {
+ if (event.GUIEvent.Caller->getID() == ID_soundExitButton) {
+ quitMenu();
+ return true;
}
- if(event.GUIEvent.EventType==gui::EGET_SCROLL_BAR_CHANGED)
- {
- if (event.GUIEvent.Caller->getID() == ID_soundSlider)
- {
- s32 pos = ((gui::IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
- g_settings->setFloat("sound_volume",(float)pos/100);
- gui::IGUIElement *e = getElementFromId(ID_soundText2);
- e->setText( core::stringw(pos).c_str() );
- return true;
- }
+ }
+
+ if (event.GUIEvent.EventType == gui::EGET_SCROLL_BAR_CHANGED) {
+ if (event.GUIEvent.Caller->getID() == ID_soundSlider) {
+ s32 pos = ((gui::IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
+ g_settings->setFloat("sound_volume", (float)pos/100);
+
+ gui::IGUIElement *e = getElementFromId(ID_soundText2);
+ e->setText(core::stringw(pos).c_str());
+ return true;
}
+ }
+
return Parent ? Parent->OnEvent(event) : false;
}