Skip to content

Commit

Permalink
this looks promising... :D
Browse files Browse the repository at this point in the history
  • Loading branch information
OmgRod committed Jan 17, 2025
1 parent 4807e7b commit fd8fc65
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 32 deletions.
4 changes: 4 additions & 0 deletions mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,5 +248,9 @@
"community": "https://discord.gg/vK3DuqJwyW",
"homepage": "https://omgrod.me",
"source": "https://github.com/OmgRod/Geodify"
},
"issues": {
"info": "Create an issue or create feature requests on the GitHub repository.",
"url": "https://github.com/OmgRod/Geodify/issues"
}
}
63 changes: 63 additions & 0 deletions src/layers/GYModSettingsPopup.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include <Geode/Geode.hpp>
#include <Geode/ui/GeodeUI.hpp>
#include <Geode/Loader.hpp>
#include <Geode/binding/ButtonSprite.hpp>
#include <Geode/loader/Mod.hpp>
#include <Geode/loader/ModSettingsManager.hpp>
#include <Geode/ui/ScrollLayer.hpp>
#include <Geode/utils/cocos.hpp>
#include <Geode/ui/General.hpp>
#include <Geode/ui/Scrollbar.hpp>
#include <Geode/loader/Setting.hpp>

#include "GYModSettingsPopup.hpp"

using namespace geode::prelude;

bool GYModSettingsPopup::setup(std::string const& modName, std::string const& modAuthor) {
this->setTitle(modName + " by " + modAuthor);

auto layerSize = this->m_obContentSize;

auto scroll = ScrollLayer::create(layerSize - ccp(0, layerSize.height * 0.1f));
scroll->setTouchEnabled(true);

for (auto& key : Mod::get()->getSettingKeys()) {
SettingNode* node;
if (auto sett = Mod::get()->getSetting(key)) {
node = sett->createNode(layerSize.width);
}
// else {
// node = UnresolvedCustomSettingNode::create(key, Mod::get(), layerSize.width);
// }

scroll->m_contentLayer->addChild(node);
}
scroll->m_contentLayer->setLayout(
ColumnLayout::create()
->setAxisReverse(true)
->setAutoGrowAxis(scroll->getContentHeight())
->setCrossAxisOverflow(false)
->setAxisAlignment(AxisAlignment::End)
->setGap(0)
);
scroll->moveToTop();

this->addChild(scroll);

return true;
}

GYModSettingsPopup* GYModSettingsPopup::create(std::string const& modName, std::string const& modAuthor) {
auto ret = new GYModSettingsPopup();

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

if (ret->initAnchored(winSize.width * 0.75f, winSize.height * 0.75f, modName, modAuthor, "GJ_square05.png")) {
ret->autorelease();
return ret;
}

delete ret;
return nullptr;
}
13 changes: 13 additions & 0 deletions src/layers/GYModSettingsPopup.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <Geode/Geode.hpp>
#include <Geode/ui/GeodeUI.hpp>
#include <Geode/Loader.hpp>

using namespace geode::prelude;

class GYModSettingsPopup : public geode::Popup<std::string const&, std::string const&> {
protected:
bool setup(std::string const& modName, std::string const& modAuthor) override;

public:
static GYModSettingsPopup* create(std::string const& modName, std::string const& modAuthor);
};
17 changes: 10 additions & 7 deletions src/layers/GYModTile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,38 @@
#include <Geode/Loader.hpp>

#include "GYModTile.hpp"
#include "Geode/binding/ButtonSprite.hpp"
#include "Geode/ui/GeodeUI.hpp"
#include "GYModSettingsPopup.hpp"

using namespace geode::prelude;

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

GYModTile* GYModTile::create(const char *modName, const char *modAuthor, const char *modID, int tag) {
GYModTile* GYModTile::create(const char *modName, const char *modAuthor, const char *modID) {
GYModTile* ret = new GYModTile();
if (ret && ret->init(modName, modAuthor, modID, tag)) {
if (ret && ret->init(modName, modAuthor, modID)) {
ret->autorelease();
return ret;
}
delete ret;
return nullptr;
}

bool GYModTile::init(const char *modName, const char *modAuthor, const char *modID, int tag) {
bool GYModTile::init(const char *modName, const char *modAuthor, const char *modID) {
if (!CCLayer::init())
return false;

this->m_modID = modID;
this->m_modName = modName;
this->m_modAuthor = modAuthor;

setMouseEnabled(true);

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

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

// GJ_square04.png - The purple one
auto bg = CCScale9Sprite::create("GJ_square04.png");
Expand Down
8 changes: 6 additions & 2 deletions src/layers/GYModTile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ using namespace geode::prelude;
class GYModTile : public CCLayer {
public:
void viewMod(CCObject* sender);
static GYModTile* create(const char *modName, const char *modAuthor, const char *modID, int tag);
bool init(const char *modName, const char *modAuthor, const char *modID, int tag);
static GYModTile* create(const char *modName, const char *modAuthor, const char *modID);
bool init(const char *modName, const char *modAuthor, const char *modID);

std::string m_modID;
std::string m_modName;
std::string m_modAuthor;
};
51 changes: 28 additions & 23 deletions src/layers/GYSettingSelectLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ bool GYSettingSelectLayer::init() {

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

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

auto leftColumn = ColumnLayout::create();
leftColumn->setAxis(Axis::Column);
leftColumn->setGap(10.f);
leftColumn->setAxisReverse(false);
leftColumn->setAutoGrowAxis(0.f);
leftColumn->setAxisReverse(true)
->setAutoGrowAxis(scroll->getContentHeight())
->setCrossAxisOverflow(false)
->setAxisAlignment(AxisAlignment::End)
->setGap(10.f);
contentLeft->setLayout(leftColumn);

auto rightColumn = ColumnLayout::create();
rightColumn->setAxis(Axis::Column);
rightColumn->setGap(10.f);
rightColumn->setAxisReverse(false);
rightColumn->setAutoGrowAxis(0.f);
rightColumn->setAxisReverse(true)
->setAutoGrowAxis(scroll->getContentHeight())
->setCrossAxisOverflow(false)
->setAxisAlignment(AxisAlignment::End)
->setGap(10.f);
contentRight->setLayout(rightColumn);

auto modTiles = {
GYModTile::create("Geometry Dash", "RobTop", "gd", 0),
GYModTile::create("BetterInfo", "Cvolton", "cvolton.betterinfo", 1),
GYModTile::create("Globed", "dankmeme", "dankmeme.globed2", 2),
GYModTile::create("Geode", "Geode Team", "geode.loader", 3),
GYModTile::create("Texture Loader", "Geode Team", "geode.texture-loader", 4),
GYModTile::create("Integrated Demonlist", "hiimjustin000", "hiimjustin000.integrated_demonlist", 5),
GYModTile::create("GDPS Switcher", "km7dev", "km7dev.gdps-switcher", 6),
GYModTile::create("BetterAchievements", "limegradient", "limegradient.betterachievements", 7),
GYModTile::create("GDDP Integration", "Minemaker0430", "minemaker0430.gddp_integration", 8),
GYModTile::create("Garage Plus", "OmgRod", "omgrod.garage_plus", 9),
GYModTile::create("GDStream", "OmgRod", "omgrod.gdstream", 10),
GYModTile::create("Geodify", "OmgRod", "omgrod.geodify", 11),
GYModTile::create("Newgrounds Explorer", "TheSillyDoggo", "thesillydoggo.newgrounds_explorer", 12),
GYModTile::create("Texture Workshop", "Uproxide", "uproxide.textures", 13),
GYModTile::create("Geometry Dash", "RobTop", "gd"),
GYModTile::create("BetterInfo", "Cvolton", "cvolton.betterinfo"),
GYModTile::create("Globed", "dankmeme", "dankmeme.globed2"),
GYModTile::create("Geode", "Geode Team", "geode.loader"),
GYModTile::create("Texture Loader", "Geode Team", "geode.texture-loader"),
GYModTile::create("Integrated Demonlist", "hiimjustin000", "hiimjustin000.integrated_demonlist"),
GYModTile::create("GDPS Switcher", "km7dev", "km7dev.gdps-switcher"),
GYModTile::create("BetterAchievements", "limegradient", "limegradient.betterachievements"),
GYModTile::create("GDDP Integration", "Minemaker0430", "minemaker0430.gddp_integration"),
GYModTile::create("Garage Plus", "OmgRod", "omgrod.garage_plus"),
GYModTile::create("GDStream", "OmgRod", "omgrod.gdstream"),
GYModTile::create("Geodify", "OmgRod", "omgrod.geodify"),
GYModTile::create("Newgrounds Explorer", "TheSillyDoggo", "thesillydoggo.newgrounds_explorer"),
GYModTile::create("Texture Workshop", "Uproxide", "uproxide.textures"),
};

bool addToLeft = true;
Expand Down Expand Up @@ -216,7 +219,7 @@ bool GYSettingSelectLayer::init() {
ColumnLayout* leftLayout = ColumnLayout::create();
leftLayout->setAxis(Axis::Column);
leftLayout->setGap(10.f);

leftMenu->setLayout(leftLayout);

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

GYSettingSelectLayer::generateModsList();

scroll->moveToTop();

this->addChild(leftMenu);
this->addChild(menu);

Expand Down

0 comments on commit fd8fc65

Please sign in to comment.