mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-01-27 02:05:06 +01:00
Adding layout minShowTime argument to set the minimum amount of time for a splash screen to show.
This commit is contained in:
parent
8f78cc0d16
commit
b9126f2476
@ -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"/>
|
||||
|
||||
@ -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()
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@ -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"))
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user