-added option to change sourceflow background with every new tier. add the following two lines to your source menu ini's:

[GENERAL]
background=filename.png (or .jpg)

and place your background images in wiiflow/source_menu/backgrounds
This commit is contained in:
Fledge68 2018-10-12 17:16:52 -05:00
parent 10f3429b29
commit 972cbc218c
6 changed files with 28 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -298,6 +298,8 @@ void CVideo::set2DViewport(u32 w, u32 h, int x, int y)
m_y2D = std::min(std::max(-50, y), 50); m_y2D = std::min(std::max(-50, y), 50);
} }
/* this takes what is drawn in the frame buffer and copies it to make a new texture/image set as whatever TexData &tex is */
/* this is used by coverflow and updatebg */
void CVideo::renderToTexture(TexData &tex, bool clear) void CVideo::renderToTexture(TexData &tex, bool clear)
{ {
if(tex.data == NULL) if(tex.data == NULL)

View File

@ -1826,10 +1826,10 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
#endif #endif
} }
void CMenu::_setBg(const TexData &bgTex, const TexData &bglqTex) void CMenu::_setBg(const TexData &bgTex, const TexData &bglqTex, bool force_change)
{ {
/* Not setting same bg again */ /* Not setting same bg again */
if(m_nextBg == &bgTex) if(!force_change && m_nextBg == &bgTex)
return; return;
m_lqBg = &bglqTex; m_lqBg = &bglqTex;
/* before setting new next bg set previous */ /* before setting new next bg set previous */

View File

@ -168,6 +168,7 @@ private:
string m_ver; string m_ver;
// Background image stuff // Background image stuff
TexData sfbgimg;
TexData m_curBg; TexData m_curBg;
const TexData *m_prevBg; const TexData *m_prevBg;
const TexData *m_nextBg; const TexData *m_nextBg;
@ -1020,7 +1021,7 @@ private:
void _updateCheckboxes(void); void _updateCheckboxes(void);
void _getGameCategories(void); void _getGameCategories(void);
void _setGameCategories(void); void _setGameCategories(void);
void _setBg(const TexData &bgTex, const TexData &bglqTex); void _setBg(const TexData &bgTex, const TexData &bglqTex, bool force_change = false);
void _updateBg(void); void _updateBg(void);
void _drawBg(void); void _drawBg(void);
void _updateText(void); void _updateText(void);
@ -1078,6 +1079,7 @@ private:
int _getSrcFlow(); int _getSrcFlow();
void _setSrcFlow(int version); void _setSrcFlow(int version);
void _srcTierBack(bool home); void _srcTierBack(bool home);
void _setSrcFlowBg();
void _mainLoopCommon(bool withCF = false, bool adjusting = false); void _mainLoopCommon(bool withCF = false, bool adjusting = false);
void _netInit(); void _netInit();
void _loadDefaultFont(void); void _loadDefaultFont(void);

View File

@ -288,6 +288,7 @@ int CMenu::main(void)
if(m_sourceflow)//if exiting sourceflow via b button if(m_sourceflow)//if exiting sourceflow via b button
{ {
m_sourceflow = false; m_sourceflow = false;
_setBg(m_mainBg, m_mainBgLQ);
_showCF(true); _showCF(true);
continue; continue;
} }
@ -305,6 +306,7 @@ int CMenu::main(void)
if(m_cfg.getBool(SOURCEFLOW_DOMAIN, "enabled", false))//if sourceflow show it if(m_cfg.getBool(SOURCEFLOW_DOMAIN, "enabled", false))//if sourceflow show it
{ {
m_sourceflow = true; m_sourceflow = true;
_setSrcFlowBg();
_showCF(true); _showCF(true);
} }
else //show source menu else //show source menu

View File

@ -122,6 +122,7 @@ void CMenu::_sourceFlow()
} }
srcDomain = m_source.nextDomain().c_str(); srcDomain = m_source.nextDomain().c_str();
} }
_setSrcFlowBg();
return; return;
} }
} }
@ -131,6 +132,7 @@ void CMenu::_sourceFlow()
m_cfg.setUInt("GENERAL", "sources", m_current_view); m_cfg.setUInt("GENERAL", "sources", m_current_view);
m_source_cnt = 1; m_source_cnt = 1;
_setSrcOptions(); _setSrcOptions();
_setBg(m_mainBg, m_mainBgLQ);
} }
int CMenu::_getSrcFlow(void) int CMenu::_getSrcFlow(void)
@ -186,6 +188,23 @@ void CMenu::_srcTierBack(bool home)
} }
srcDomain = m_source.nextDomain().c_str(); srcDomain = m_source.nextDomain().c_str();
} }
_setSrcFlowBg();
}
void CMenu::_setSrcFlowBg(void)
{
string fn = m_source.getString("general", "background", "");
if(fn.length() > 0)
{
TexHandle.Cleanup(sfbgimg);
if(TexHandle.fromImageFile(sfbgimg, fmt("%s/backgrounds/%s", m_sourceDir.c_str(), fn.c_str())) == TE_OK)
{
//const TexData *sfbg = &sfbgimg;
_setBg(sfbgimg, sfbgimg, true);
}
}
else
_setBg(m_mainBg, m_mainBgLQ);
} }
void CMenu::_hideSource(bool instant) void CMenu::_hideSource(bool instant)