mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-06-28 12:39:50 +03:00
The instance-on-demand didn't really work, since we needed explicit control over this object's destruction to ensure the timer is stopped when launching an application. And trying to combine getInstance() with explicit external delete was just ugly.
30 lines
543 B
C++
30 lines
543 B
C++
#ifndef POWERSAVER_H
|
|
#define POWERSAVER_H
|
|
|
|
#include <SDL.h>
|
|
|
|
class PowerSaver {
|
|
public:
|
|
PowerSaver();
|
|
~PowerSaver();
|
|
void resetScreenTimer();
|
|
void setScreenTimeout(unsigned int seconds);
|
|
|
|
private:
|
|
void addScreenTimer();
|
|
void removeScreenTimer();
|
|
void setScreenBlanking(bool state);
|
|
void enableScreen();
|
|
void disableScreen();
|
|
|
|
static PowerSaver *instance;
|
|
bool screenState;
|
|
unsigned int screenTimeout;
|
|
unsigned int timeout_startms;
|
|
SDL_TimerID screenTimer;
|
|
|
|
friend Uint32 screenTimerCallback(Uint32 timeout, void *d);
|
|
};
|
|
|
|
#endif
|