Skip to content

Commit fd8fc65

Browse files
committed
this looks promising... :D
1 parent 4807e7b commit fd8fc65

File tree

6 files changed

+124
-32
lines changed

6 files changed

+124
-32
lines changed

mod.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,5 +248,9 @@
248248
"community": "https://discord.gg/vK3DuqJwyW",
249249
"homepage": "https://omgrod.me",
250250
"source": "https://github.com/OmgRod/Geodify"
251+
},
252+
"issues": {
253+
"info": "Create an issue or create feature requests on the GitHub repository.",
254+
"url": "https://github.com/OmgRod/Geodify/issues"
251255
}
252256
}

src/layers/GYModSettingsPopup.cpp

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#include <Geode/Geode.hpp>
2+
#include <Geode/ui/GeodeUI.hpp>
3+
#include <Geode/Loader.hpp>
4+
#include <Geode/binding/ButtonSprite.hpp>
5+
#include <Geode/loader/Mod.hpp>
6+
#include <Geode/loader/ModSettingsManager.hpp>
7+
#include <Geode/ui/ScrollLayer.hpp>
8+
#include <Geode/utils/cocos.hpp>
9+
#include <Geode/ui/General.hpp>
10+
#include <Geode/ui/Scrollbar.hpp>
11+
#include <Geode/loader/Setting.hpp>
12+
13+
#include "GYModSettingsPopup.hpp"
14+
15+
using namespace geode::prelude;
16+
17+
bool GYModSettingsPopup::setup(std::string const& modName, std::string const& modAuthor) {
18+
this->setTitle(modName + " by " + modAuthor);
19+
20+
auto layerSize = this->m_obContentSize;
21+
22+
auto scroll = ScrollLayer::create(layerSize - ccp(0, layerSize.height * 0.1f));
23+
scroll->setTouchEnabled(true);
24+
25+
for (auto& key : Mod::get()->getSettingKeys()) {
26+
SettingNode* node;
27+
if (auto sett = Mod::get()->getSetting(key)) {
28+
node = sett->createNode(layerSize.width);
29+
}
30+
// else {
31+
// node = UnresolvedCustomSettingNode::create(key, Mod::get(), layerSize.width);
32+
// }
33+
34+
scroll->m_contentLayer->addChild(node);
35+
}
36+
scroll->m_contentLayer->setLayout(
37+
ColumnLayout::create()
38+
->setAxisReverse(true)
39+
->setAutoGrowAxis(scroll->getContentHeight())
40+
->setCrossAxisOverflow(false)
41+
->setAxisAlignment(AxisAlignment::End)
42+
->setGap(0)
43+
);
44+
scroll->moveToTop();
45+
46+
this->addChild(scroll);
47+
48+
return true;
49+
}
50+
51+
GYModSettingsPopup* GYModSettingsPopup::create(std::string const& modName, std::string const& modAuthor) {
52+
auto ret = new GYModSettingsPopup();
53+
54+
auto winSize = CCDirector::sharedDirector()->getWinSize();
55+
56+
if (ret->initAnchored(winSize.width * 0.75f, winSize.height * 0.75f, modName, modAuthor, "GJ_square05.png")) {
57+
ret->autorelease();
58+
return ret;
59+
}
60+
61+
delete ret;
62+
return nullptr;
63+
}

src/layers/GYModSettingsPopup.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <Geode/Geode.hpp>
2+
#include <Geode/ui/GeodeUI.hpp>
3+
#include <Geode/Loader.hpp>
4+
5+
using namespace geode::prelude;
6+
7+
class GYModSettingsPopup : public geode::Popup<std::string const&, std::string const&> {
8+
protected:
9+
bool setup(std::string const& modName, std::string const& modAuthor) override;
10+
11+
public:
12+
static GYModSettingsPopup* create(std::string const& modName, std::string const& modAuthor);
13+
};

src/layers/GYModTile.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,38 @@
33
#include <Geode/Loader.hpp>
44

55
#include "GYModTile.hpp"
6-
#include "Geode/binding/ButtonSprite.hpp"
7-
#include "Geode/ui/GeodeUI.hpp"
6+
#include "GYModSettingsPopup.hpp"
87

98
using namespace geode::prelude;
109

1110
void GYModTile::viewMod(CCObject* sender) {
12-
log::debug("Viewing mod: {}", this->getTag());
11+
log::debug("Viewing mod: {}", this->m_modID);
12+
GYModSettingsPopup::create(this->m_modName, this->m_modAuthor)->show();
1313
}
1414

15-
GYModTile* GYModTile::create(const char *modName, const char *modAuthor, const char *modID, int tag) {
15+
GYModTile* GYModTile::create(const char *modName, const char *modAuthor, const char *modID) {
1616
GYModTile* ret = new GYModTile();
17-
if (ret && ret->init(modName, modAuthor, modID, tag)) {
17+
if (ret && ret->init(modName, modAuthor, modID)) {
1818
ret->autorelease();
1919
return ret;
2020
}
2121
delete ret;
2222
return nullptr;
2323
}
2424

25-
bool GYModTile::init(const char *modName, const char *modAuthor, const char *modID, int tag) {
25+
bool GYModTile::init(const char *modName, const char *modAuthor, const char *modID) {
2626
if (!CCLayer::init())
2727
return false;
28+
29+
this->m_modID = modID;
30+
this->m_modName = modName;
31+
this->m_modAuthor = modAuthor;
2832

2933
setMouseEnabled(true);
3034

3135
auto winSize = CCDirector::sharedDirector()->getWinSize();
3236

3337
this->setContentSize({ winSize.width * 0.325f, winSize.height * 0.5f });
34-
this->setTag(tag);
3538

3639
// GJ_square04.png - The purple one
3740
auto bg = CCScale9Sprite::create("GJ_square04.png");

src/layers/GYModTile.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ using namespace geode::prelude;
77
class GYModTile : public CCLayer {
88
public:
99
void viewMod(CCObject* sender);
10-
static GYModTile* create(const char *modName, const char *modAuthor, const char *modID, int tag);
11-
bool init(const char *modName, const char *modAuthor, const char *modID, int tag);
10+
static GYModTile* create(const char *modName, const char *modAuthor, const char *modID);
11+
bool init(const char *modName, const char *modAuthor, const char *modID);
12+
13+
std::string m_modID;
14+
std::string m_modName;
15+
std::string m_modAuthor;
1216
};

src/layers/GYSettingSelectLayer.cpp

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ bool GYSettingSelectLayer::init() {
117117

118118
ScrollLayer* scroll = ScrollLayer::create({ winSize.width * 0.7f, winSize.height * 0.7f }, true, true);
119119
scroll->setID("scroll");
120+
scroll->setTouchEnabled(true);
120121
contentBox->addChild(scroll);
121122

122123
auto contentLeft = CCLayer::create();
@@ -132,34 +133,36 @@ bool GYSettingSelectLayer::init() {
132133
contentRight->setAnchorPoint({ 0, 0 });
133134

134135
auto leftColumn = ColumnLayout::create();
135-
leftColumn->setAxis(Axis::Column);
136-
leftColumn->setGap(10.f);
137-
leftColumn->setAxisReverse(false);
138-
leftColumn->setAutoGrowAxis(0.f);
136+
leftColumn->setAxisReverse(true)
137+
->setAutoGrowAxis(scroll->getContentHeight())
138+
->setCrossAxisOverflow(false)
139+
->setAxisAlignment(AxisAlignment::End)
140+
->setGap(10.f);
139141
contentLeft->setLayout(leftColumn);
140142

141143
auto rightColumn = ColumnLayout::create();
142-
rightColumn->setAxis(Axis::Column);
143-
rightColumn->setGap(10.f);
144-
rightColumn->setAxisReverse(false);
145-
rightColumn->setAutoGrowAxis(0.f);
144+
rightColumn->setAxisReverse(true)
145+
->setAutoGrowAxis(scroll->getContentHeight())
146+
->setCrossAxisOverflow(false)
147+
->setAxisAlignment(AxisAlignment::End)
148+
->setGap(10.f);
146149
contentRight->setLayout(rightColumn);
147150

148151
auto modTiles = {
149-
GYModTile::create("Geometry Dash", "RobTop", "gd", 0),
150-
GYModTile::create("BetterInfo", "Cvolton", "cvolton.betterinfo", 1),
151-
GYModTile::create("Globed", "dankmeme", "dankmeme.globed2", 2),
152-
GYModTile::create("Geode", "Geode Team", "geode.loader", 3),
153-
GYModTile::create("Texture Loader", "Geode Team", "geode.texture-loader", 4),
154-
GYModTile::create("Integrated Demonlist", "hiimjustin000", "hiimjustin000.integrated_demonlist", 5),
155-
GYModTile::create("GDPS Switcher", "km7dev", "km7dev.gdps-switcher", 6),
156-
GYModTile::create("BetterAchievements", "limegradient", "limegradient.betterachievements", 7),
157-
GYModTile::create("GDDP Integration", "Minemaker0430", "minemaker0430.gddp_integration", 8),
158-
GYModTile::create("Garage Plus", "OmgRod", "omgrod.garage_plus", 9),
159-
GYModTile::create("GDStream", "OmgRod", "omgrod.gdstream", 10),
160-
GYModTile::create("Geodify", "OmgRod", "omgrod.geodify", 11),
161-
GYModTile::create("Newgrounds Explorer", "TheSillyDoggo", "thesillydoggo.newgrounds_explorer", 12),
162-
GYModTile::create("Texture Workshop", "Uproxide", "uproxide.textures", 13),
152+
GYModTile::create("Geometry Dash", "RobTop", "gd"),
153+
GYModTile::create("BetterInfo", "Cvolton", "cvolton.betterinfo"),
154+
GYModTile::create("Globed", "dankmeme", "dankmeme.globed2"),
155+
GYModTile::create("Geode", "Geode Team", "geode.loader"),
156+
GYModTile::create("Texture Loader", "Geode Team", "geode.texture-loader"),
157+
GYModTile::create("Integrated Demonlist", "hiimjustin000", "hiimjustin000.integrated_demonlist"),
158+
GYModTile::create("GDPS Switcher", "km7dev", "km7dev.gdps-switcher"),
159+
GYModTile::create("BetterAchievements", "limegradient", "limegradient.betterachievements"),
160+
GYModTile::create("GDDP Integration", "Minemaker0430", "minemaker0430.gddp_integration"),
161+
GYModTile::create("Garage Plus", "OmgRod", "omgrod.garage_plus"),
162+
GYModTile::create("GDStream", "OmgRod", "omgrod.gdstream"),
163+
GYModTile::create("Geodify", "OmgRod", "omgrod.geodify"),
164+
GYModTile::create("Newgrounds Explorer", "TheSillyDoggo", "thesillydoggo.newgrounds_explorer"),
165+
GYModTile::create("Texture Workshop", "Uproxide", "uproxide.textures"),
163166
};
164167

165168
bool addToLeft = true;
@@ -216,7 +219,7 @@ bool GYSettingSelectLayer::init() {
216219
ColumnLayout* leftLayout = ColumnLayout::create();
217220
leftLayout->setAxis(Axis::Column);
218221
leftLayout->setGap(10.f);
219-
222+
220223
leftMenu->setLayout(leftLayout);
221224

222225
CCMenuItemSpriteExtra* colorBtn = CCMenuItemSpriteExtra::create(
@@ -252,6 +255,8 @@ bool GYSettingSelectLayer::init() {
252255

253256
GYSettingSelectLayer::generateModsList();
254257

258+
scroll->moveToTop();
259+
255260
this->addChild(leftMenu);
256261
this->addChild(menu);
257262

0 commit comments

Comments
 (0)