Skip to content

Commit

Permalink
fixed uip and ui options layers
Browse files Browse the repository at this point in the history
  • Loading branch information
OmgRod committed Feb 8, 2025
1 parent fe9d651 commit 686845a
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 21 deletions.
20 changes: 19 additions & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"id": "omgrod.geodify",
"name": "Geodify",
"developers": ["OmgRod", "Viper"],
"description": "Converts most menus' backgrounds to the Geode one (SwelvyBG).",
"description": "Converts most backgrounds to Geode's background (SwelvyBG).",
"early-load": true,
"resources": {
"files": [
Expand Down Expand Up @@ -209,12 +209,30 @@
"type": "bool",
"default": true
},
"gd/SecretLayer5": {
"name": "The Wraith",
"description": "SecretLayer5",
"type": "bool",
"default": true
},
"gd/GJShopLayer": {
"name": "Shops (Currently just all of them)",
"description": "GJShopLayer",
"type": "bool",
"default": true
},
"gd/UIOptionsLayer": {
"name": "ui",
"description": "UIOptionsLayer",
"type": "bool",
"default": true
},
"gd/UIPOptionsLayer": {
"name": "uip",
"description": "UIPOptionsLayer",
"type": "bool",
"default": true
},
"mods-title": {
"type": "title",
"name": "Mods Settings"
Expand Down
21 changes: 21 additions & 0 deletions src/SwelvyBG.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,27 @@ class $nodeModify(my##layer, layer) {\
}\
}


#define SET_SWELVY_SPRITE_NOBG(layer, setting) \
class $nodeModify(my##layer, layer) { \
void modify() { \
int lowestZ = INT_MAX;\
CCNode* node = nullptr;\
CCObject* obj = nullptr; \
CCARRAY_FOREACH(getChildren(), obj) { \
if (node) { \
lowestZ = std::min(lowestZ, node->getZOrder()); \
} \
} \
\
if (Mod::get()->getSettingValue<bool>(setting)) { \
SwelvyBG* swelvyBG = SwelvyBG::create(); \
swelvyBG->setZOrder(lowestZ - 1);\
addChild(swelvyBG); \
} \
} \
}

class SwelvyBG : public CCNode {
protected:
bool init(float widthmult, float heightmul, float minspeed, float maxspeed);
Expand Down
7 changes: 7 additions & 0 deletions src/modify/gd/SecretLayer5.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <Geode/Geode.hpp>
#include "../../SwelvyBG.hpp"
#include <alphalaneous.alphas_geode_utils/include/NodeModding.h>

using namespace geode::prelude;

SET_SWELVY_SPRITE(SecretLayer5, "gd/SecretLayer5");
27 changes: 27 additions & 0 deletions src/modify/gd/UIOptionsLayer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "../../SwelvyBG.hpp"
#include <Geode/Geode.hpp>
#include <Geode/modify/CCLayer.hpp>

using namespace geode::prelude;

class $modify(MyCCLayer, CCLayer) {
void onEnter() {
CCLayer::onEnter();

if (auto parent = dynamic_cast<UIOptionsLayer*>(this->getParent())) {
if (Mod::get()->getSettingValue<bool>("gd/UIOptionsLayer")) {
int lowestZ = INT_MAX;
CCObject* obj = nullptr;
CCARRAY_FOREACH(this->getChildren(), obj) {
if (auto node = dynamic_cast<CCNode*>(obj)) {
lowestZ = std::min(lowestZ, node->getZOrder());
}
}

auto swelvyBG = SwelvyBG::create();
swelvyBG->setZOrder(lowestZ - 1);
this->addChild(swelvyBG);
}
}
}
};
44 changes: 24 additions & 20 deletions src/modify/gd/UIPOptionsLayer.cpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
// #include "../../SwelvyBG.hpp"
// #include <Geode/Geode.hpp>
// #include <Geode/modify/UIPOptionsLayer.hpp>
#include "../../SwelvyBG.hpp"
#include <Geode/Geode.hpp>
#include <Geode/modify/CCLayer.hpp>

// using namespace geode::prelude;
using namespace geode::prelude;

// class $modify(MyUIPOptionsLayer, UIPOptionsLayer) {
// bool init() {
// if (!UIPOptionsLayer::init()) {
// return false;
// }
// if (Mod::get()->getSettingValue<bool>("gd/UIPOptionsLayer")){
// // this->setOpacity(0);
// auto swelvyBG = SwelvyBG::create();
// swelvyBG->setZOrder(-3);
//
class $modify(MyCCLayer, CCLayer) {
void onEnter() {
CCLayer::onEnter();

// auto layer = this->getChildOfType<CCLayer*>(0);
// layer->addChild(swelvyBG);
// }
// return true;
// }
// };
if (auto parent = dynamic_cast<UIPOptionsLayer*>(this->getParent())) {
if (Mod::get()->getSettingValue<bool>("gd/UIPOptionsLayer")) {
int lowestZ = INT_MAX;
CCObject* obj = nullptr;
CCARRAY_FOREACH(this->getChildren(), obj) {
if (auto node = dynamic_cast<CCNode*>(obj)) {
lowestZ = std::min(lowestZ, node->getZOrder());
}
}

auto swelvyBG = SwelvyBG::create();
swelvyBG->setZOrder(lowestZ - 1);
this->addChild(swelvyBG);
}
}
}
};

0 comments on commit 686845a

Please sign in to comment.