Skip to content

Commit

Permalink
If you insist... Closes #10
Browse files Browse the repository at this point in the history
  • Loading branch information
hiimjasmine00 committed Oct 13, 2024
1 parent 0405810 commit 90d3f47
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 32 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)

project(MoreIcons VERSION 1.3.1)
project(MoreIcons VERSION 1.3.2)

add_library(${PROJECT_NAME} SHARED
src/classes/DummyNode.cpp
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# More Icons Changelog
## v1.3.2 (2024-10-13)
- Changed the More Icons button in the icon kit to only show the info when there are no logs

## v1.3.1 (2024-10-12)
- Fixed a bug where the game would crash when pressing the More Icons button in the icon kit

Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"win": "2.206",
"mac": "2.206"
},
"version": "v1.3.1",
"version": "v1.3.2",
"id": "hiimjustin000.more_icons",
"name": "More Icons",
"developer": "hiimjustin000",
Expand Down
40 changes: 37 additions & 3 deletions src/MoreIcons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class MoreIcons {
static void loadTrail(const std::filesystem::path& path);

static void saveTrails() {
for (auto& [trail, info] : MoreIcons::TRAIL_INFO) {
for (auto& [trail, info] : TRAIL_INFO) {
std::fstream file(std::filesystem::path(info.texture).replace_extension(".json"), std::ios::out);
file << matjson::Value(matjson::Object{
{ "blend", info.blend },
Expand Down Expand Up @@ -306,14 +306,48 @@ class MoreIcons {
}

static void useCustomRobot(GJRobotSprite* robot, const std::string& robotFile) {
if (!robot || robotFile.empty() || !MoreIcons::hasRobot(robotFile)) return;
if (!robot || robotFile.empty() || !hasRobot(robotFile)) return;
useCustomSprite(robot, robotFile);
}

static void useCustomSpider(GJSpiderSprite* spider, const std::string& spiderFile) {
if (!spider || spiderFile.empty() || !MoreIcons::hasSpider(spiderFile)) return;
if (!spider || spiderFile.empty() || !hasSpider(spiderFile)) return;
useCustomSprite(spider, spiderFile);
}

static void useCustomSprite(GJRobotSprite* robot, const std::string& file);

static void showInfoPopup(bool folderButton = false) {
geode::createQuickPopup(
"More Icons",
fmt::format(
"<cg>Icons</c>: {}\n"
"<cp>Ships</c>: {}\n"
"<cr>Balls</c>: {}\n"
"<co>UFOs</c>: {}\n"
"<cj>Waves</c>: {}\n"
"Robots: {}\n"
"<ca>Spiders</c>: {}\n"
"<cy>Swings</c>: {}\n"
"<cd>Jetpacks</c>: {}\n"
"<cb>Trails</c>: {}",
ICONS.size(),
SHIPS.size(),
BALLS.size(),
UFOS.size(),
WAVES.size(),
ROBOTS.size(),
SPIDERS.size(),
SWINGS.size(),
JETPACKS.size(),
TRAILS.size()
),
"OK",
folderButton ? "Folder" : nullptr,
300.0f,
[folderButton](auto, bool btn2) {
if (folderButton && btn2) geode::utils::file::openFolder(geode::Mod::get()->getConfigDir());
}
);
}
};
27 changes: 1 addition & 26 deletions src/classes/LogLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,7 @@ bool LogLayer::setup() {
m_mainLayer->addChild(topButtons);

topButtons->addChild(CCMenuItemExt::createSpriteExtraWithFrameName("GJ_infoIcon_001.png", 1.0f, [this](auto) {
FLAlertLayer::create(
"More Icons",
fmt::format(
"<cg>Icons</c>: {}\n"
"<cp>Ships</c>: {}\n"
"<cr>Balls</c>: {}\n"
"<co>UFOs</c>: {}\n"
"<cj>Waves</c>: {}\n"
"Robots: {}\n"
"<ca>Spiders</c>: {}\n"
"<cy>Swings</c>: {}\n"
"<cd>Jetpacks</c>: {}\n"
"<cb>Trails</c>: {}",
MoreIcons::ICONS.size(),
MoreIcons::SHIPS.size(),
MoreIcons::BALLS.size(),
MoreIcons::UFOS.size(),
MoreIcons::WAVES.size(),
MoreIcons::ROBOTS.size(),
MoreIcons::SPIDERS.size(),
MoreIcons::SWINGS.size(),
MoreIcons::JETPACKS.size(),
MoreIcons::TRAILS.size()
),
"OK"
)->show();
MoreIcons::showInfoPopup();
}));
topButtons->addChild(CCMenuItemExt::createSpriteExtraWithFrameName("folderIcon_001.png", 0.7f, [this](auto) {
file::openFolder(Mod::get()->getConfigDir());
Expand Down
5 changes: 4 additions & 1 deletion src/hooks/GJGarageLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ class $modify(MIGarageLayer, GJGarageLayer) {
severitySprite->setScale(0.6f);
moreIconsSprite->addChild(severitySprite, 1);
}
auto moreIconsButton = CCMenuItemExt::createSpriteExtra(moreIconsSprite, [this](auto) { LogLayer::create()->show(); });
auto moreIconsButton = CCMenuItemExt::createSpriteExtra(moreIconsSprite, [this](auto) {
if (!MoreIcons::LOGS.empty()) LogLayer::create()->show();
else MoreIcons::showInfoPopup(true);
});
moreIconsButton->setID("more-icons-button"_spr);
if (auto shardsMenu = getChildByID("shards-menu")) {
shardsMenu->addChild(moreIconsButton);
Expand Down

0 comments on commit 90d3f47

Please sign in to comment.