mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-30 03:55:40 +00:00
Renamed "dim" to "screensaver".
Added "screensaver behavior" option, which can be "dim" or "black".
This commit is contained in:
parent
7250d0b00b
commit
327367b6bd
|
@ -41,7 +41,7 @@ void Settings::setDefaults()
|
||||||
mBoolMap["DebugGrid"] = false;
|
mBoolMap["DebugGrid"] = false;
|
||||||
mBoolMap["DebugText"] = false;
|
mBoolMap["DebugText"] = false;
|
||||||
|
|
||||||
mIntMap["DimTime"] = 120*1000;
|
mIntMap["ScreenSaverTime"] = 5*60*1000; // 5 minutes
|
||||||
mIntMap["ScraperResizeWidth"] = 400;
|
mIntMap["ScraperResizeWidth"] = 400;
|
||||||
mIntMap["ScraperResizeHeight"] = 0;
|
mIntMap["ScraperResizeHeight"] = 0;
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ void Settings::setDefaults()
|
||||||
|
|
||||||
mStringMap["TransitionStyle"] = "fade";
|
mStringMap["TransitionStyle"] = "fade";
|
||||||
mStringMap["ThemeSet"] = "";
|
mStringMap["ThemeSet"] = "";
|
||||||
|
mStringMap["ScreenSaverBehavior"] = "dim";
|
||||||
|
|
||||||
mScraper = std::shared_ptr<Scraper>(new GamesDBScraper());
|
mScraper = std::shared_ptr<Scraper>(new GamesDBScraper());
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,11 +93,21 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MEN
|
||||||
[this] {
|
[this] {
|
||||||
auto s = new GuiSettings(mWindow, "UI SETTINGS");
|
auto s = new GuiSettings(mWindow, "UI SETTINGS");
|
||||||
|
|
||||||
// dim time
|
// screensaver time
|
||||||
auto dim_time = std::make_shared<SliderComponent>(mWindow, 0.f, 30.f, 1.f, "m");
|
auto screensaver_time = std::make_shared<SliderComponent>(mWindow, 0.f, 30.f, 1.f, "m");
|
||||||
dim_time->setValue((float)(Settings::getInstance()->getInt("DimTime") / (1000 * 60)));
|
screensaver_time->setValue((float)(Settings::getInstance()->getInt("ScreenSaverTime") / (1000 * 60)));
|
||||||
s->addWithLabel("DIM SCREEN AFTER", dim_time);
|
s->addWithLabel("SCREENSAVER AFTER", screensaver_time);
|
||||||
s->addSaveFunc([dim_time] { Settings::getInstance()->setInt("DimTime", (int)round(dim_time->getValue()) * (1000 * 60)); });
|
s->addSaveFunc([screensaver_time] { Settings::getInstance()->setInt("ScreenSaverTime", (int)round(screensaver_time->getValue()) * (1000 * 60)); });
|
||||||
|
|
||||||
|
// screensaver behavior
|
||||||
|
auto screensaver_behavior = std::make_shared< OptionListComponent<std::string> >(mWindow, "TRANSITION STYLE", false);
|
||||||
|
std::vector<std::string> screensavers;
|
||||||
|
screensavers.push_back("dim");
|
||||||
|
screensavers.push_back("black");
|
||||||
|
for(auto it = screensavers.begin(); it != screensavers.end(); it++)
|
||||||
|
screensaver_behavior->add(*it, *it, Settings::getInstance()->getString("ScreenSaverBehavior") == *it);
|
||||||
|
s->addWithLabel("SCREENSAVER BEHAVIOR", screensaver_behavior);
|
||||||
|
s->addSaveFunc([screensaver_behavior] { Settings::getInstance()->setString("ScreenSaverBehavior", screensaver_behavior->getSelected()); });
|
||||||
|
|
||||||
// framerate
|
// framerate
|
||||||
auto framerate = std::make_shared<SwitchComponent>(mWindow);
|
auto framerate = std::make_shared<SwitchComponent>(mWindow);
|
||||||
|
|
|
@ -259,12 +259,14 @@ int main(int argc, char* argv[])
|
||||||
//sleeping entails setting a flag to start skipping frames
|
//sleeping entails setting a flag to start skipping frames
|
||||||
//and initially drawing a black semi-transparent rect to dim the screen
|
//and initially drawing a black semi-transparent rect to dim the screen
|
||||||
timeSinceLastEvent += deltaTime;
|
timeSinceLastEvent += deltaTime;
|
||||||
if(timeSinceLastEvent >= (unsigned int)Settings::getInstance()->getInt("DimTime") && Settings::getInstance()->getInt("DimTime") != 0 && window.getAllowSleep())
|
if(timeSinceLastEvent >= (unsigned int)Settings::getInstance()->getInt("ScreenSaverTime") && Settings::getInstance()->getInt("ScreenSaverTime") != 0 && window.getAllowSleep())
|
||||||
{
|
{
|
||||||
sleeping = true;
|
sleeping = true;
|
||||||
timeSinceLastEvent = 0;
|
timeSinceLastEvent = 0;
|
||||||
Renderer::setMatrix(Eigen::Affine3f::Identity());
|
Renderer::setMatrix(Eigen::Affine3f::Identity());
|
||||||
Renderer::drawRect(0, 0, Renderer::getScreenWidth(), Renderer::getScreenHeight(), 0x000000A0);
|
|
||||||
|
unsigned char opacity = Settings::getInstance()->getString("ScreenSaverBehavior") == "dim" ? 0xA0 : 0xFF;
|
||||||
|
Renderer::drawRect(0, 0, Renderer::getScreenWidth(), Renderer::getScreenHeight(), 0x00000000 | opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
Renderer::swapBuffers();
|
Renderer::swapBuffers();
|
||||||
|
|
Loading…
Reference in a new issue