mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-13 22:49:52 -04:00
first moves oh lord
This commit is contained in:
parent
9c9c75d46b
commit
ae24abbcec
3 changed files with 41 additions and 0 deletions
BIN
loader/resources/copy.png
Normal file
BIN
loader/resources/copy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -375,6 +375,17 @@ bool ModsLayer::init() {
|
|||
folderBtn->setID("mods-folder-button");
|
||||
actionsMenu->addChild(folderBtn);
|
||||
|
||||
auto copySpr = createGeodeCircleButton(
|
||||
CCSprite::createWithSpriteFrameName("copy.png"_spr), 1.f,
|
||||
CircleBaseSize::Medium
|
||||
);
|
||||
copySpr->setScale(.8f);
|
||||
auto copyBtn = CCMenuItemSpriteExtra::create(
|
||||
copySpr, this, menu_selector(ModsLayer::onCopy)
|
||||
);
|
||||
copyBtn->setID("copy-button");
|
||||
actionsMenu->addChild(copyBtn);
|
||||
|
||||
actionsMenu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
|
@ -702,6 +713,35 @@ void ModsLayer::onSettings(CCObject*) {
|
|||
openSettingsPopup(Mod::get());
|
||||
}
|
||||
|
||||
void ModsLayer::onCopy(CCObject*) {
|
||||
auto text = "No mods installed";
|
||||
auto mods = Loader::get()->getAllMods();
|
||||
if (!mods.empty()) text = "Mods list copied to clipboard!";
|
||||
|
||||
auto* label = CCLabelBMFont::create(text, "bigFont.fnt");
|
||||
label->setPosition(CCDirector::get()->getWinSize() / 2);
|
||||
label->setOpacity(0);
|
||||
label->runAction(CCSequence::create(
|
||||
CCFadeIn::create(.5f),
|
||||
CCDelayTime::create(1.f),
|
||||
CCFadeOut::create(.5f),
|
||||
nullptr
|
||||
));
|
||||
this->addChild(label);
|
||||
|
||||
std::stringstream ss;
|
||||
using namespace std::string_view_literals;
|
||||
for (auto& mod : mods) {
|
||||
ss << fmt::format("{} | [{}] {}\n",
|
||||
mod->isEnabled() ? "x"sv :
|
||||
mod->hasProblems() ? "!"sv :
|
||||
" "sv,
|
||||
mod->getVersion().toVString(), mod->getID()
|
||||
);
|
||||
}
|
||||
clipboard::write(ss.str());
|
||||
}
|
||||
|
||||
ModsLayer* ModsLayer::create() {
|
||||
auto ret = new ModsLayer();
|
||||
if (ret->init()) {
|
||||
|
|
|
@ -80,6 +80,7 @@ protected:
|
|||
void onRefreshList(CCObject*);
|
||||
void onTheme(CCObject*);
|
||||
void onSettings(CCObject*);
|
||||
void onCopy(CCObject*);
|
||||
void onBack(CCObject*);
|
||||
|
||||
void updateState();
|
||||
|
|
Loading…
Reference in a new issue