Skip to content

Commit

Permalink
fix length label
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Sep 15, 2023
1 parent f88bfc5 commit 21078e6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/hooks/LevelInfoLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class $modify(LevelInfoLayer) {
auto cache = BetterInfoCache::sharedState();
cache->storeDatesForLevel(this->m_level);

auto label = typeinfo_cast<CCLabelBMFont*>(getChildByID("length-label"));
//auto label = typeinfo_cast<CCLabelBMFont*>(getChildByID("length-label"));
auto label = m_lengthLabel;
if(label) {
auto bmFont = CCLabelBMFont::create("Loading", "bigFont.fnt");
bmFont->setID("bi-exact-time");
Expand All @@ -41,10 +42,11 @@ class $modify(LevelInfoLayer) {
LevelInfoLayer::updateLabelValues();
std::thread([this](){
auto wt = ExtendedLevelInfo::workingTime(std::round(BetterInfo::timeForLevelString(m_level->m_levelString)));
//since whatever is done by queueInMainThread is guaranteed to execute after init is finished, this shouldn't result in a race condition
Loader::get()->queueInMainThread([this, wt]() {
auto label = typeinfo_cast<CCLabelBMFont*>(getChildByID("length-label"));
//auto label = typeinfo_cast<CCLabelBMFont*>(getChildByID("length-label"));
auto bmFont = typeinfo_cast<CCLabelBMFont*>(getChildByID("bi-exact-time"));
if(label && bmFont) {
if(bmFont) {
bmFont->setString(fmt::format("{}", wt).c_str());
//label->setString(fmt::format("{} ({})", label->getString(), wt).c_str());
}
Expand Down

0 comments on commit 21078e6

Please sign in to comment.