-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
124 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters