diff --git a/RetroFE/Source/Graphics/Component/ReloadableText.cpp b/RetroFE/Source/Graphics/Component/ReloadableText.cpp index c9c9396..2dd6db0 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableText.cpp +++ b/RetroFE/Source/Graphics/Component/ReloadableText.cpp @@ -24,7 +24,7 @@ #include #include -ReloadableText::ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, float scaleX, float scaleY) +ReloadableText::ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, std::string timeFormat, float scaleX, float scaleY) : Component(page) , config_(config) , imageInst_(NULL) @@ -33,6 +33,7 @@ ReloadableText::ReloadableText(std::string type, Page &page, Configuration &conf , reloadRequested_(false) , firstLoad_(true) , fontInst_(font) + , timeFormat_(timeFormat) , scaleX_(scaleX) , scaleY_(scaleY) { @@ -118,7 +119,7 @@ void ReloadableText::ReloadTexture() struct tm tstruct; char buf[80]; tstruct = *localtime(&now); - strftime(buf, sizeof(buf), "%r", &tstruct); + strftime(buf, sizeof(buf), timeFormat_.c_str(), &tstruct); ss << buf; } if (type_ == "numberButtons") diff --git a/RetroFE/Source/Graphics/Component/ReloadableText.h b/RetroFE/Source/Graphics/Component/ReloadableText.h index 76c7d2a..2d5ae19 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableText.h +++ b/RetroFE/Source/Graphics/Component/ReloadableText.h @@ -25,7 +25,7 @@ class ReloadableText : public Component { public: - ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, float scaleX, float scaleY); + ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, std::string timeFormat, float scaleX, float scaleY); virtual ~ReloadableText(); void update(float dt); void draw(); @@ -44,6 +44,7 @@ private: bool reloadRequested_; bool firstLoad_; Font *fontInst_; + std::string timeFormat_; float scaleX_; float scaleY_; diff --git a/RetroFE/Source/Graphics/PageBuilder.cpp b/RetroFE/Source/Graphics/PageBuilder.cpp index b9557e0..35ec921 100644 --- a/RetroFE/Source/Graphics/PageBuilder.cpp +++ b/RetroFE/Source/Graphics/PageBuilder.cpp @@ -403,6 +403,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName, std::string reloadableVideoPath; xml_attribute<> *type = componentXml->first_attribute("type"); xml_attribute<> *mode = componentXml->first_attribute("mode"); + xml_attribute<> *timeFormatXml = componentXml->first_attribute("timeFormat"); xml_attribute<> *selectedOffsetXml = componentXml->first_attribute("selectedOffset"); bool systemMode = false; int selectedOffset = 0; @@ -446,7 +447,12 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName, if(type) { Font *font = addFont(componentXml, NULL); - c = new ReloadableText(type->value(), *page, config_, font, layoutKey, scaleX_, scaleY_); + std::string timeFormat = "%H:%M"; + if (timeFormatXml) + { + timeFormat = timeFormatXml->value(); + } + c = new ReloadableText(type->value(), *page, config_, font, layoutKey, timeFormat, scaleX_, scaleY_); } } else