mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-05-02 02:49:38 +02:00
Adding layout minShowTime argument to set the minimum amount of time for a splash screen to show.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<layout width="1920" height="1080" font="LoveloBlack.otf" loadFontSize="32" fontColor="dedede">
|
<layout width="1920" height="1080" font="LoveloBlack.otf" loadFontSize="32" fontColor="dedede" minShowTime="2">
|
||||||
|
|
||||||
<!--backgroundImage-->
|
<!--backgroundImage-->
|
||||||
<image src="bkgnd.png" x="0" y="0" height="stretch" width="stretch" layer="0"/>
|
<image src="bkgnd.png" x="0" y="0" height="stretch" width="stretch" layer="0"/>
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ Page::Page(Configuration &config)
|
|||||||
, SelectSoundChunk(NULL)
|
, SelectSoundChunk(NULL)
|
||||||
, HasSoundedWhenActive(false)
|
, HasSoundedWhenActive(false)
|
||||||
, FirstSoundPlayed(false)
|
, FirstSoundPlayed(false)
|
||||||
|
, MinShowTime(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,6 +287,15 @@ void Page::RemoveSelectedItem()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Page::SetMinShowTime(float value)
|
||||||
|
{
|
||||||
|
MinShowTime = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
float Page::GetMinShowTime()
|
||||||
|
{
|
||||||
|
return MinShowTime;
|
||||||
|
}
|
||||||
|
|
||||||
void Page::Highlight()
|
void Page::Highlight()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ public:
|
|||||||
void LaunchEnter();
|
void LaunchEnter();
|
||||||
void LaunchExit();
|
void LaunchExit();
|
||||||
std::string GetCollectionName();
|
std::string GetCollectionName();
|
||||||
|
void SetMinShowTime(float value);
|
||||||
|
float GetMinShowTime();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Highlight();
|
void Highlight();
|
||||||
@@ -100,6 +102,8 @@ private:
|
|||||||
Sound *SelectSoundChunk;
|
Sound *SelectSoundChunk;
|
||||||
bool HasSoundedWhenActive;
|
bool HasSoundedWhenActive;
|
||||||
bool FirstSoundPlayed;
|
bool FirstSoundPlayed;
|
||||||
|
float MinShowTime;
|
||||||
|
float ElapsedTime;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ Page *PageBuilder::BuildPage()
|
|||||||
xml_attribute<> *fontXml = root->first_attribute("font");
|
xml_attribute<> *fontXml = root->first_attribute("font");
|
||||||
xml_attribute<> *fontColorXml = root->first_attribute("fontColor");
|
xml_attribute<> *fontColorXml = root->first_attribute("fontColor");
|
||||||
xml_attribute<> *fontSizeXml = root->first_attribute("loadFontSize");
|
xml_attribute<> *fontSizeXml = root->first_attribute("loadFontSize");
|
||||||
|
xml_attribute<> *minShowTimeXml = root->first_attribute("minShowTime");
|
||||||
|
|
||||||
int layoutHeight;
|
int layoutHeight;
|
||||||
int layoutWidth;
|
int layoutWidth;
|
||||||
@@ -165,6 +166,11 @@ Page *PageBuilder::BuildPage()
|
|||||||
|
|
||||||
page = new Page(Config);
|
page = new Page(Config);
|
||||||
|
|
||||||
|
if(minShowTimeXml)
|
||||||
|
{
|
||||||
|
page->SetMinShowTime(Utils::ConvertFloat(minShowTimeXml->value()));
|
||||||
|
}
|
||||||
|
|
||||||
// load sounds
|
// load sounds
|
||||||
for(xml_node<> *sound = root->first_node("sound"); sound; sound = sound->next_sibling("sound"))
|
for(xml_node<> *sound = root->first_node("sound"); sound; sound = sound->next_sibling("sound"))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ void RetroFE::Run()
|
|||||||
if(!SDL::Initialize(Config)) return;
|
if(!SDL::Initialize(Config)) return;
|
||||||
|
|
||||||
FC.Initialize();
|
FC.Initialize();
|
||||||
|
float preloadTime = 0;
|
||||||
bool videoEnable = true;
|
bool videoEnable = true;
|
||||||
int videoLoop = 0;
|
int videoLoop = 0;
|
||||||
Config.GetProperty("videoEnable", videoEnable);
|
Config.GetProperty("videoEnable", videoEnable);
|
||||||
@@ -215,6 +215,7 @@ void RetroFE::Run()
|
|||||||
bool splashMode = true;
|
bool splashMode = true;
|
||||||
|
|
||||||
Launcher l(*this, Config);
|
Launcher l(*this, Config);
|
||||||
|
preloadTime = static_cast<float>(SDL_GetTicks()) / 1000;
|
||||||
|
|
||||||
while (running)
|
while (running)
|
||||||
{
|
{
|
||||||
@@ -242,7 +243,7 @@ void RetroFE::Run()
|
|||||||
(void)SDL_PollEvent(&e);
|
(void)SDL_PollEvent(&e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Initialized && splashMode)
|
if(Initialized && splashMode && CurrentPage->GetMinShowTime() <= (CurrentTime - preloadTime))
|
||||||
{
|
{
|
||||||
SDL_WaitThread(InitializeThread, &initializeStatus);
|
SDL_WaitThread(InitializeThread, &initializeStatus);
|
||||||
|
|
||||||
@@ -317,7 +318,7 @@ void RetroFE::Run()
|
|||||||
if(running)
|
if(running)
|
||||||
{
|
{
|
||||||
lastTime = CurrentTime;
|
lastTime = CurrentTime;
|
||||||
CurrentTime = (float)SDL_GetTicks() / 1000;
|
CurrentTime = static_cast<float>(SDL_GetTicks()) / 1000;
|
||||||
|
|
||||||
if (CurrentTime < lastTime)
|
if (CurrentTime < lastTime)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user