Merge pull request #178 from pjft/Fix-sliders

Moving slider entries in the menus back to the top
This commit is contained in:
Jools Wills 2017-07-08 04:45:02 +01:00 committed by GitHub
commit f30187f0d4

View file

@ -70,6 +70,12 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MEN
[this] { [this] {
auto s = new GuiSettings(mWindow, "SOUND SETTINGS"); auto s = new GuiSettings(mWindow, "SOUND SETTINGS");
// volume
auto volume = std::make_shared<SliderComponent>(mWindow, 0.f, 100.f, 1.f, "%");
volume->setValue((float)VolumeControl::getInstance()->getVolume());
s->addWithLabel("SYSTEM VOLUME", volume);
s->addSaveFunc([volume] { VolumeControl::getInstance()->setVolume((int)round(volume->getValue())); });
#ifdef _RPI_ #ifdef _RPI_
// volume control device // volume control device
auto vol_dev = std::make_shared< OptionListComponent<std::string> >(mWindow, "AUDIO DEVICE", false); auto vol_dev = std::make_shared< OptionListComponent<std::string> >(mWindow, "AUDIO DEVICE", false);
@ -87,12 +93,6 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MEN
}); });
#endif #endif
// volume
auto volume = std::make_shared<SliderComponent>(mWindow, 0.f, 100.f, 1.f, "%");
volume->setValue((float)VolumeControl::getInstance()->getVolume());
s->addWithLabel("SYSTEM VOLUME", volume);
s->addSaveFunc([volume] { VolumeControl::getInstance()->setVolume((int)round(volume->getValue())); });
// disable sounds // disable sounds
auto sounds_enabled = std::make_shared<SwitchComponent>(mWindow); auto sounds_enabled = std::make_shared<SwitchComponent>(mWindow);
sounds_enabled->setState(Settings::getInstance()->getBool("EnableSounds")); sounds_enabled->setState(Settings::getInstance()->getBool("EnableSounds"));
@ -247,6 +247,12 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MEN
[this] { [this] {
auto s = new GuiSettings(mWindow, "OTHER SETTINGS"); auto s = new GuiSettings(mWindow, "OTHER SETTINGS");
// maximum vram
auto max_vram = std::make_shared<SliderComponent>(mWindow, 0.f, 1000.f, 10.f, "Mb");
max_vram->setValue((float)(Settings::getInstance()->getInt("MaxVRAM")));
s->addWithLabel("VRAM LIMIT", max_vram);
s->addSaveFunc([max_vram] { Settings::getInstance()->setInt("MaxVRAM", (int)round(max_vram->getValue())); });
// gamelists // gamelists
auto save_gamelists = std::make_shared<SwitchComponent>(mWindow); auto save_gamelists = std::make_shared<SwitchComponent>(mWindow);
save_gamelists->setState(Settings::getInstance()->getBool("SaveGamelistsOnExit")); save_gamelists->setState(Settings::getInstance()->getBool("SaveGamelistsOnExit"));
@ -278,12 +284,6 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MEN
#endif #endif
// maximum vram
auto max_vram = std::make_shared<SliderComponent>(mWindow, 0.f, 1000.f, 10.f, "Mb");
max_vram->setValue((float)(Settings::getInstance()->getInt("MaxVRAM")));
s->addWithLabel("VRAM LIMIT", max_vram);
s->addSaveFunc([max_vram] { Settings::getInstance()->setInt("MaxVRAM", (int)round(max_vram->getValue())); });
// framerate // framerate
auto framerate = std::make_shared<SwitchComponent>(mWindow); auto framerate = std::make_shared<SwitchComponent>(mWindow);
framerate->setState(Settings::getInstance()->getBool("DrawFramerate")); framerate->setState(Settings::getInstance()->getBool("DrawFramerate"));