Skip to content

Commit

Permalink
new feature no way
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepdotcom committed Nov 20, 2024
1 parent d8a0fa4 commit 3e7e774
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ This is where she makes a mod.
<img src="logo.png" width="150" alt="the mod's logo" />

*Update logo.png to change your mod's icon (please)*
I'm not an artist shut up
4 changes: 3 additions & 1 deletion about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Geode UI Tweaks

Tweak the Geode Mod List UI a bit.
Tweak the Geode Mod List UI a bit.

(May or may not be more than a bit soon enough)
7 changes: 5 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# 1.0.0
- Edit this file to change your mod's changelog.
# v0.0.1

- Transparent Lists
- Larger Logos
- Fix Mod Info Size
8 changes: 7 additions & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"geode": "4.0.0-beta.1",
"geode": "4.0.1",
"gd": {
"win": "2.2074",
"android": "2.2074",
Expand Down Expand Up @@ -27,6 +27,12 @@
"description": "Increases the size of the logos on mod items.",
"type": "bool",
"default": false
},
"fix-mod-info-size": {
"name": "Fix Mod Info Size",
"description": "Increases the width of the info container to extend all the way to the download count.",
"type": "bool",
"default": false
}
}
}
37 changes: 29 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ bool isGeodeTheme(bool forceDisableTheme = false) {
return !forceDisableTheme && Loader::get()->getInstalledMod("geode.loader")->getSettingValue<bool>("enable-geode-theme");
}

// Soooo about the indentations, uh nullptr checking i guess? dont want game to randomly crash!
// Also getting certain things might be wierd but like i dont wanna make hacky way around a private class and private members

void modsLayerModify(CCNode* modsLayer) {
auto mod = Mod::get();
if (auto modListFrame = modsLayer->getChildByID("mod-list-frame")) {
Expand Down Expand Up @@ -51,29 +54,31 @@ void modsLayerModify(CCNode* modsLayer) {
if (node->getID() == "ModItem") {
if (auto bg = static_cast<CCScale9Sprite*>(node->getChildByID("bg"))) {
if (mod->getSettingValue<bool>("transparent-lists")) {
if ((bg->getColor() == ccColor3B{255, 255, 255} && bg->getOpacity() == 25) || (bg->getColor() == ccColor3B{0, 0, 0} && bg->getOpacity() == 90)) { // Enabled
auto rgb = bg->getColor();
auto color = ccColor4B{rgb.b, rgb.g, rgb.b, bg->getOpacity()};
if (color == ccColor4B{255, 255, 255, 25} || color == ccColor4B{0, 0, 0, 90}) { // Enabled
bg->setOpacity(isGeodeTheme() ? 50 : 90);
bg->setColor(ccColor3B{0, 0, 0});
}
else if (bg->getColor() == ccColor3B{153, 245, 245} && bg->getOpacity() == 25) { // Restart Required
else if (color == ccColor4B{153, 245, 245, 25}) { // Restart Required
bg->setOpacity(90);
bg->setColor(ccColor3B{245, 27, 27});
bg->setColor(ccColor3B{123, 156, 163});
}
else if (bg->getColor() == ccColor3B{255, 255, 255} && bg->getOpacity() == 10) { // Disabled
else if (color == ccColor4B{255, 255, 255, 10}) { // Disabled
bg->setOpacity(50);
bg->setColor(ccColor3B{205, 205, 205});
}
else if (bg->getColor() == ccColor3B{235, 35, 112} && bg->getOpacity() == 25) { // Error
else if (color == ccColor4B{235, 35, 112, 25}) { // Error
bg->setOpacity(90);
bg->setColor(ccColor3B{245, 27, 27});
}
else if (bg->getColor() == ccColor3B{245, 153, 245} && bg->getOpacity() == 25) { // Outdated
else if (color == ccColor4B{245, 153, 245, 25}) { // Outdated
bg->setOpacity(90);
}
else if (bg->getColor() == ccColor3B{240, 211, 42} && bg->getOpacity() == 65) { // Featured
else if (color == ccColor4B{240, 211, 42, 65}) { // Featured
bg->setOpacity(90);
}
else if (bg->getColor() == ccColor3B{63, 91, 138} && bg->getOpacity() == 85) { // Modtober
else if (color == ccColor4B{63, 91, 138, 85}) { // Modtober
bg->setOpacity(90);
bg->setColor(ccColor3B{32, 102, 220});
}
Expand All @@ -86,6 +91,20 @@ void modsLayerModify(CCNode* modsLayer) {
logoSprite->setScale(logoSprite->getScale() == 0.7f ? 0.6f : 0.4f);
}
}
if (auto infoContainer = node->getChildByID("info-container")) {
if (mod->getSettingValue<bool>("fix-mod-info-size")) {
auto titleContainer = infoContainer->querySelector("title-container");
auto developersMenu = infoContainer->querySelector("developers-menu");
if (titleContainer && developersMenu) {
infoContainer->setContentWidth(525.f);
infoContainer->updateLayout();
titleContainer->setContentWidth(525.f);
titleContainer->updateLayout();
developersMenu->setContentWidth(525.f);
developersMenu->updateLayout();
}
}
}
}
}
}
Expand Down Expand Up @@ -140,6 +159,8 @@ class $modify(CCScheduler) {
}
};

// Imagine using geode's little ui events (they also dont work for my problems hehe)

/*$execute {
new EventListener<EventFilter<ModItemUIEvent>>(+[](ModItemUIEvent* event) {
auto mod = Mod::get();
Expand Down

0 comments on commit 3e7e774

Please sign in to comment.