mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Added love.window.setScreenSaverEnabled and love.window.isScreenSaverEnabled (resolves issue #1088.)
This commit is contained in:
@@ -67,6 +67,9 @@ Window::Window()
|
||||
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
|
||||
throw love::Exception("Could not initialize SDL video subsystem (%s)", SDL_GetError());
|
||||
|
||||
// Make sure the screensaver doesn't activate by default.
|
||||
setScreenSaverEnabled(false);
|
||||
|
||||
SDL_version version = {};
|
||||
SDL_GetVersion(&version);
|
||||
hasSDL203orEarlier = (version.major == 2 && version.minor == 0 && version.patch <= 3);
|
||||
@@ -842,6 +845,19 @@ love::image::ImageData *Window::getIcon()
|
||||
return curMode.icon.get();
|
||||
}
|
||||
|
||||
void Window::setScreenSaverEnabled(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
SDL_EnableScreenSaver();
|
||||
else
|
||||
SDL_DisableScreenSaver();
|
||||
}
|
||||
|
||||
bool Window::isScreenSaverEnabled() const
|
||||
{
|
||||
return SDL_IsScreenSaverEnabled() != SDL_FALSE;
|
||||
}
|
||||
|
||||
void Window::minimize()
|
||||
{
|
||||
if (window != nullptr)
|
||||
|
||||
@@ -70,6 +70,9 @@ public:
|
||||
bool setIcon(love::image::ImageData *imgd);
|
||||
love::image::ImageData *getIcon();
|
||||
|
||||
void setScreenSaverEnabled(bool enable);
|
||||
bool isScreenSaverEnabled() const;
|
||||
|
||||
void minimize();
|
||||
void maximize();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user