Skip to content

Commit 686845a

Browse files
committed
fixed uip and ui options layers
1 parent fe9d651 commit 686845a

File tree

5 files changed

+98
-21
lines changed

5 files changed

+98
-21
lines changed

mod.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"id": "omgrod.geodify",
1010
"name": "Geodify",
1111
"developers": ["OmgRod", "Viper"],
12-
"description": "Converts most menus' backgrounds to the Geode one (SwelvyBG).",
12+
"description": "Converts most backgrounds to Geode's background (SwelvyBG).",
1313
"early-load": true,
1414
"resources": {
1515
"files": [
@@ -209,12 +209,30 @@
209209
"type": "bool",
210210
"default": true
211211
},
212+
"gd/SecretLayer5": {
213+
"name": "The Wraith",
214+
"description": "SecretLayer5",
215+
"type": "bool",
216+
"default": true
217+
},
212218
"gd/GJShopLayer": {
213219
"name": "Shops (Currently just all of them)",
214220
"description": "GJShopLayer",
215221
"type": "bool",
216222
"default": true
217223
},
224+
"gd/UIOptionsLayer": {
225+
"name": "ui",
226+
"description": "UIOptionsLayer",
227+
"type": "bool",
228+
"default": true
229+
},
230+
"gd/UIPOptionsLayer": {
231+
"name": "uip",
232+
"description": "UIPOptionsLayer",
233+
"type": "bool",
234+
"default": true
235+
},
218236
"mods-title": {
219237
"type": "title",
220238
"name": "Mods Settings"

src/SwelvyBG.hpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,27 @@ class $nodeModify(my##layer, layer) {\
3232
}\
3333
}
3434

35+
36+
#define SET_SWELVY_SPRITE_NOBG(layer, setting) \
37+
class $nodeModify(my##layer, layer) { \
38+
void modify() { \
39+
int lowestZ = INT_MAX;\
40+
CCNode* node = nullptr;\
41+
CCObject* obj = nullptr; \
42+
CCARRAY_FOREACH(getChildren(), obj) { \
43+
if (node) { \
44+
lowestZ = std::min(lowestZ, node->getZOrder()); \
45+
} \
46+
} \
47+
\
48+
if (Mod::get()->getSettingValue<bool>(setting)) { \
49+
SwelvyBG* swelvyBG = SwelvyBG::create(); \
50+
swelvyBG->setZOrder(lowestZ - 1);\
51+
addChild(swelvyBG); \
52+
} \
53+
} \
54+
}
55+
3556
class SwelvyBG : public CCNode {
3657
protected:
3758
bool init(float widthmult, float heightmul, float minspeed, float maxspeed);

src/modify/gd/SecretLayer5.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <Geode/Geode.hpp>
2+
#include "../../SwelvyBG.hpp"
3+
#include <alphalaneous.alphas_geode_utils/include/NodeModding.h>
4+
5+
using namespace geode::prelude;
6+
7+
SET_SWELVY_SPRITE(SecretLayer5, "gd/SecretLayer5");

src/modify/gd/UIOptionsLayer.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include "../../SwelvyBG.hpp"
2+
#include <Geode/Geode.hpp>
3+
#include <Geode/modify/CCLayer.hpp>
4+
5+
using namespace geode::prelude;
6+
7+
class $modify(MyCCLayer, CCLayer) {
8+
void onEnter() {
9+
CCLayer::onEnter();
10+
11+
if (auto parent = dynamic_cast<UIOptionsLayer*>(this->getParent())) {
12+
if (Mod::get()->getSettingValue<bool>("gd/UIOptionsLayer")) {
13+
int lowestZ = INT_MAX;
14+
CCObject* obj = nullptr;
15+
CCARRAY_FOREACH(this->getChildren(), obj) {
16+
if (auto node = dynamic_cast<CCNode*>(obj)) {
17+
lowestZ = std::min(lowestZ, node->getZOrder());
18+
}
19+
}
20+
21+
auto swelvyBG = SwelvyBG::create();
22+
swelvyBG->setZOrder(lowestZ - 1);
23+
this->addChild(swelvyBG);
24+
}
25+
}
26+
}
27+
};

src/modify/gd/UIPOptionsLayer.cpp

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
1-
// #include "../../SwelvyBG.hpp"
2-
// #include <Geode/Geode.hpp>
3-
// #include <Geode/modify/UIPOptionsLayer.hpp>
1+
#include "../../SwelvyBG.hpp"
2+
#include <Geode/Geode.hpp>
3+
#include <Geode/modify/CCLayer.hpp>
44

5-
// using namespace geode::prelude;
5+
using namespace geode::prelude;
66

7-
// class $modify(MyUIPOptionsLayer, UIPOptionsLayer) {
8-
// bool init() {
9-
// if (!UIPOptionsLayer::init()) {
10-
// return false;
11-
// }
12-
// if (Mod::get()->getSettingValue<bool>("gd/UIPOptionsLayer")){
13-
// // this->setOpacity(0);
14-
// auto swelvyBG = SwelvyBG::create();
15-
// swelvyBG->setZOrder(-3);
16-
//
7+
class $modify(MyCCLayer, CCLayer) {
8+
void onEnter() {
9+
CCLayer::onEnter();
1710

18-
// auto layer = this->getChildOfType<CCLayer*>(0);
19-
// layer->addChild(swelvyBG);
20-
// }
21-
// return true;
22-
// }
23-
// };
11+
if (auto parent = dynamic_cast<UIPOptionsLayer*>(this->getParent())) {
12+
if (Mod::get()->getSettingValue<bool>("gd/UIPOptionsLayer")) {
13+
int lowestZ = INT_MAX;
14+
CCObject* obj = nullptr;
15+
CCARRAY_FOREACH(this->getChildren(), obj) {
16+
if (auto node = dynamic_cast<CCNode*>(obj)) {
17+
lowestZ = std::min(lowestZ, node->getZOrder());
18+
}
19+
}
20+
21+
auto swelvyBG = SwelvyBG::create();
22+
swelvyBG->setZOrder(lowestZ - 1);
23+
this->addChild(swelvyBG);
24+
}
25+
}
26+
}
27+
};

0 commit comments

Comments
 (0)