From f35df47071b88657ddd92fffce7031ae6241c0d8 Mon Sep 17 00:00:00 2001 From: Explodingbill Date: Thu, 29 Aug 2024 21:16:22 +1000 Subject: [PATCH] percentage label --- changelog.md | 2 ++ src/Client/ClientSetup.h | 2 +- src/Client/Types/InputModule.cpp | 6 ++++-- src/Labels/Labels.cpp | 7 ++++++- src/Labels/Labels.h | 1 + 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 41c476b..c512d71 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,7 @@ # 1.6.3 +- Fixed Custom Message Label text being cut off to 12 characters +- Added **Percentage Label** - Ported **Show Trajectory** to 2.206 - This is a COMPLETE REWRITE of Show Trajectory, Fixing many issues such as portals activating early and the trail disappearing sometimes diff --git a/src/Client/ClientSetup.h b/src/Client/ClientSetup.h index dd2909d..891eb57 100644 --- a/src/Client/ClientSetup.h +++ b/src/Client/ClientSetup.h @@ -406,6 +406,7 @@ class ClientUtils replay->modules.push_back(new Module("CPS Counter", "status-cps", "Shows your clicks per second. Tints Green while you are clicking")); replay->modules.push_back(new Module("Best Run", "best-run", "Shows your best run")); replay->modules.push_back(new Module("Clock", "status-clock", "Shows your current device time")); + replay->modules.push_back(new Module("Percentage", "status-percentage", "Copies the text from the percentage label in-game")); //replay->modules.push_back(new StatusMessage()); @@ -528,7 +529,6 @@ class ClientUtils #ifdef GEODE_IS_MACOS std::vector macInc = { - "show-trajectory", "show-layout", "no-wave", "no-particles", diff --git a/src/Client/Types/InputModule.cpp b/src/Client/Types/InputModule.cpp index 079035a..4919567 100644 --- a/src/Client/Types/InputModule.cpp +++ b/src/Client/Types/InputModule.cpp @@ -78,8 +78,10 @@ void InputModule::load() { text = Mod::get()->getSavedValue(id + "_value", text); - if (this->text.size() > 12) - this->text = this->text.substr(0, 12); + Loader::get()->queueInMainThread([this]{ + if (this->text.size() > maxSize) + this->text = this->text.substr(0, maxSize); + }); } void InputModule::updateValue() diff --git a/src/Labels/Labels.cpp b/src/Labels/Labels.cpp index d5de291..3d5b12b 100644 --- a/src/Labels/Labels.cpp +++ b/src/Labels/Labels.cpp @@ -35,7 +35,7 @@ bool StatusNode::init() bottomRight->setID("bottom-right"); this->addChild(bottomRight); - int count = 11; + int count = 12; for (size_t i = 0; i < count; i++) { @@ -237,6 +237,9 @@ void StatusNode::update(float dt) if (!clock) clock = Client::GetModule("status-clock"); + + if (!percentage) + percentage = Client::GetModule("status-percentage"); if (!attPL) attPL = static_cast(GJBaseGameLayer::get()); @@ -262,6 +265,7 @@ void StatusNode::update(float dt) sLabels[8]->setVisible(cpsM->enabled); sLabels[9]->setVisible(bestRun->enabled); sLabels[10]->setVisible(clock->enabled); + sLabels[11]->setVisible(percentage->enabled); if (PlayLayer::get()) { @@ -334,6 +338,7 @@ void StatusNode::update(float dt) sLabels[9]->setString("Best Run: Editor"); sLabels[10]->setString(formatTime().c_str()); + sLabels[11]->setString(fmt::format("{}", PlayLayer::get() && PlayLayer::get()->m_percentageLabel ? PlayLayer::get()->m_percentageLabel->getString() : "").c_str()); updateVis(); } diff --git a/src/Labels/Labels.h b/src/Labels/Labels.h index d8717d8..f3970ac 100644 --- a/src/Labels/Labels.h +++ b/src/Labels/Labels.h @@ -67,6 +67,7 @@ class StatusNode : public CCNode static inline Module* cpsM = nullptr; static inline Module* bestRun = nullptr; static inline Module* clock = nullptr; + static inline Module* percentage = nullptr; static inline Module* noclip = nullptr;