diff --git a/src/gui/guiVolumeChange.cpp b/src/gui/guiVolumeChange.cpp index 45444c47c..fbd192108 100644 --- a/src/gui/guiVolumeChange.cpp +++ b/src/gui/guiVolumeChange.cpp @@ -21,11 +21,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "debug.h" #include "guiBackgroundImage.h" #include "guiButton.h" +#include "guiScrollBar.h" #include "serialization.h" #include #include #include -#include #include #include #include "settings.h" @@ -139,12 +139,19 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize) e->setStyles(StyleSpec::getButtonStyle()); } { - core::rect rect(0, 0, 320 * s, 25 * s); + core::rect rect(0, 0, 320 * s, 30 * s); rect = rect + v2s32(size.X / 2 - 160 * s, size.Y / 2 - 12 * s); // 30 - gui::IGUIScrollBar *e = Environment->addScrollBar(true, - rect, this, ID_soundSlider); + GUIScrollBar *e = new GUIScrollBar(Environment, this, + ID_soundSlider, rect, true, false); e->setMax(100); e->setPos(volume); + e->setArrowsVisible(GUIScrollBar::ArrowVisibility::SHOW); + e->setTextures({ + m_tsrc->getTexture("gui/scrollbar_horiz_bg.png"), + m_tsrc->getTexture("gui/scrollbar_slider.png"), + m_tsrc->getTexture("gui/scrollbar_minus.png"), + m_tsrc->getTexture("gui/scrollbar_plus.png"), + }); } /*{ core::rect rect(0, 0, 150 * s, 25 * s); @@ -219,7 +226,7 @@ bool GUIVolumeChange::OnEvent(const SEvent& event) } 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 = ((GUIScrollBar*)event.GUIEvent.Caller)->getPos(); g_settings->setFloat("sound_volume", (float) pos / 100); // unmute sound when changing the volume diff --git a/textures/base/pack/gui/scrollbar_horiz_bg.png b/textures/base/pack/gui/scrollbar_horiz_bg.png new file mode 100644 index 000000000..0cfff289f Binary files /dev/null and b/textures/base/pack/gui/scrollbar_horiz_bg.png differ diff --git a/textures/base/pack/gui/scrollbar_minus.png b/textures/base/pack/gui/scrollbar_minus.png new file mode 100644 index 000000000..6d16d12e6 Binary files /dev/null and b/textures/base/pack/gui/scrollbar_minus.png differ diff --git a/textures/base/pack/gui/scrollbar_plus.png b/textures/base/pack/gui/scrollbar_plus.png new file mode 100644 index 000000000..cbf5a2d5f Binary files /dev/null and b/textures/base/pack/gui/scrollbar_plus.png differ diff --git a/textures/base/pack/gui/scrollbar_slider.png b/textures/base/pack/gui/scrollbar_slider.png new file mode 100644 index 000000000..61ac13628 Binary files /dev/null and b/textures/base/pack/gui/scrollbar_slider.png differ