Skip to content

Commit

Permalink
add ldm object count
Browse files Browse the repository at this point in the history
  • Loading branch information
HJfod committed Nov 19, 2024
1 parent 1d8fa9a commit 0265bde
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# BetterEdit 6

## v6.9.0-alpha.2
* Add <cy>LDM Object Count</c> to the pause menu

## v6.9.0-alpha.1
* Support for <cy>GD 2.2704</c> and <ca>Geode 4.0.0-beta.1</c>

Expand Down
4 changes: 2 additions & 2 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"geode": "4.0.0-beta.1",
"version": "6.9.0-alpha.1",
"geode": "4.0.0-beta.2",
"version": "6.9.0-alpha.2",
"gd": {
"win": "2.2074",
"mac": "2.2074",
Expand Down
26 changes: 26 additions & 0 deletions src/features/LDMObjectCount.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <Geode/modify/EditorPauseLayer.hpp>
#include <Geode/binding/LevelEditorLayer.hpp>
#include <Geode/binding/GameObject.hpp>

using namespace geode::prelude;

class $modify(EditorPauseLayer) {
bool init(LevelEditorLayer* lel) {
if (!EditorPauseLayer::init(lel))
return false;

if (auto label = static_cast<CCLabelBMFont*>(this->querySelector("object-count-label"))) {
size_t ldmCount = 0;
for (auto obj : CCArrayExt<GameObject*>(lel->m_objects)) {
ldmCount += obj->m_isHighDetail;
}
label->setString(fmt::format(
"{} | LDM: {} ({}%)",
label->getString(), ldmCount,
lel->m_objects->count() ? static_cast<int>(100.f * ldmCount / lel->m_objects->count()) : 0
).c_str());
}

return true;
}
};

0 comments on commit 0265bde

Please sign in to comment.