-wiiflow will now slightly fadeout to black after one minute of no activity

This commit is contained in:
fix94.1 2013-09-15 21:22:19 +00:00
parent 87ac92f857
commit 6bb7f326f0
5 changed files with 49 additions and 2 deletions

View File

@ -86,7 +86,8 @@ CVideo::CVideo(void) :
m_rmode(NULL), m_frameBuf(), m_curFB(0), m_fifo(NULL),
m_yScale(0.0f), m_xfbHeight(0), m_wide(false),
m_width2D(640), m_height2D(480), m_x2D(0), m_y2D(0), m_aa(0), m_aaAlpha(false),
m_aaWidth(0), m_aaHeight(0), m_showWaitMessage(false), m_showingWaitMessages(false)
m_aaWidth(0), m_aaHeight(0), m_screensaver_alpha(0), m_showWaitMessage(false),
m_showingWaitMessages(false)
{
memset(m_frameBuf, 0, sizeof m_frameBuf);
}
@ -724,3 +725,18 @@ void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color)
GX_End();
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
}
void CVideo::screensaver(u32 no_input)
{
if(no_input == 0)
{
m_screensaver_alpha = 0;
return;
}
if(no_input > 60)
{
DrawRectangle(0, 0, 640, 480, (GXColor){0,0,0,m_screensaver_alpha});
if(m_screensaver_alpha < 150)
m_screensaver_alpha+=2;
}
}

View File

@ -54,6 +54,7 @@ public:
void renderToTexture(TexData &tex, bool clear);
void cleanup(void);
void setup2DProjection(bool setViewPort = true, bool noScale = false);
void screensaver(u32 no_input);
u32 width(void) const { return m_rmode->fbWidth; }
u32 height(void) const { return m_rmode->efbHeight; }
GXRModeObj *vid_mode(void) const { return m_rmode; }
@ -93,6 +94,7 @@ private:
int m_aaHeight;
u8 *m_aaBuffer[8];
u32 m_aaBufferSize[8];
u8 m_screensaver_alpha;
float m_vpX;
float m_vpY;
float m_vpW;

View File

@ -154,6 +154,8 @@ CMenu::CMenu()
/* ftp stuff */
m_ftp_inited = false;
m_init_ftp = false;
/* screensaver */
no_input_time = 0;
}
void CMenu::init()
@ -1879,8 +1881,10 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
m_btnMgr.draw();
ScanInput();
if(!m_vid.showingWaitMessage())
{
m_vid.screensaver(NoInputTime());
m_vid.render();
}
if(Sys_Exiting())
exitHandler(BUTTON_CALLBACK);

View File

@ -631,11 +631,13 @@ private:
s32 right_stick_skip[WPAD_MAX_WIIMOTES];
s32 wmote_roll_skip[WPAD_MAX_WIIMOTES];
bool enable_wmote_roll;
time_t no_input_time;
bool m_cfNeedsUpdate;
void SetupInput(bool reset_pos = false);
void ScanInput(void);
u32 NoInputTime(void);
void ButtonsPressed(void);
void ButtonsHeld(void);

View File

@ -584,3 +584,26 @@ void CMenu::ShowGameZone()
{
ShowZone(m_gameButtonsZone, m_show_zone_game);
}
u32 CMenu::NoInputTime()
{
bool input_found = false;
if(gc_btnsPressed != 0)
input_found = true;
else
{
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
if(wii_btnsPressed[chan] != 0 || wii_btnsHeld[chan] != 0 || m_show_pointer[chan] == true)
input_found = true;
}
}
if(input_found == false)
{
if(no_input_time == 0)
no_input_time = time(NULL);
return time(NULL) - no_input_time;
}
no_input_time = 0;
return 0;
}