Adding layout minShowTime argument to set the minimum amount of time for a splash screen to show.

This commit is contained in:
emb 2015-03-03 21:21:57 -06:00
parent 8f78cc0d16
commit b9126f2476
5 changed files with 25 additions and 4 deletions

View File

@ -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-->
<image src="bkgnd.png" x="0" y="0" height="stretch" width="stretch" layer="0"/>

View File

@ -40,6 +40,7 @@ Page::Page(Configuration &config)
, SelectSoundChunk(NULL)
, HasSoundedWhenActive(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()
{

View File

@ -73,6 +73,8 @@ public:
void LaunchEnter();
void LaunchExit();
std::string GetCollectionName();
void SetMinShowTime(float value);
float GetMinShowTime();
private:
void Highlight();
@ -100,6 +102,8 @@ private:
Sound *SelectSoundChunk;
bool HasSoundedWhenActive;
bool FirstSoundPlayed;
float MinShowTime;
float ElapsedTime;
};

View File

@ -113,6 +113,7 @@ Page *PageBuilder::BuildPage()
xml_attribute<> *fontXml = root->first_attribute("font");
xml_attribute<> *fontColorXml = root->first_attribute("fontColor");
xml_attribute<> *fontSizeXml = root->first_attribute("loadFontSize");
xml_attribute<> *minShowTimeXml = root->first_attribute("minShowTime");
int layoutHeight;
int layoutWidth;
@ -165,6 +166,11 @@ Page *PageBuilder::BuildPage()
page = new Page(Config);
if(minShowTimeXml)
{
page->SetMinShowTime(Utils::ConvertFloat(minShowTimeXml->value()));
}
// load sounds
for(xml_node<> *sound = root->first_node("sound"); sound; sound = sound->next_sibling("sound"))
{

View File

@ -179,7 +179,7 @@ void RetroFE::Run()
if(!SDL::Initialize(Config)) return;
FC.Initialize();
float preloadTime = 0;
bool videoEnable = true;
int videoLoop = 0;
Config.GetProperty("videoEnable", videoEnable);
@ -215,6 +215,7 @@ void RetroFE::Run()
bool splashMode = true;
Launcher l(*this, Config);
preloadTime = static_cast<float>(SDL_GetTicks()) / 1000;
while (running)
{
@ -242,7 +243,7 @@ void RetroFE::Run()
(void)SDL_PollEvent(&e);
}
if(Initialized && splashMode)
if(Initialized && splashMode && CurrentPage->GetMinShowTime() <= (CurrentTime - preloadTime))
{
SDL_WaitThread(InitializeThread, &initializeStatus);
@ -317,7 +318,7 @@ void RetroFE::Run()
if(running)
{
lastTime = CurrentTime;
CurrentTime = (float)SDL_GetTicks() / 1000;
CurrentTime = static_cast<float>(SDL_GetTicks()) / 1000;
if (CurrentTime < lastTime)
{