mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-30 11:17:08 -05:00
Compare commits
13 commits
603f70452c
...
6d0b6228f7
Author | SHA1 | Date | |
---|---|---|---|
|
6d0b6228f7 | ||
|
d0eb881ebc | ||
|
3222c12e90 | ||
|
f45b8b7128 | ||
|
0da9cef29f | ||
|
9a46231420 | ||
|
cded0523a5 | ||
|
2e039a9cea | ||
|
ae24abbcec | ||
|
9c9c75d46b | ||
|
d117d50fb0 | ||
|
b80efe0517 | ||
|
7d40c8188f |
4 changed files with 47 additions and 1 deletions
BIN
loader/resources/copy.png
Normal file
BIN
loader/resources/copy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
|
@ -375,6 +375,17 @@ bool ModsLayer::init() {
|
||||||
folderBtn->setID("mods-folder-button");
|
folderBtn->setID("mods-folder-button");
|
||||||
actionsMenu->addChild(folderBtn);
|
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(
|
actionsMenu->setLayout(
|
||||||
ColumnLayout::create()
|
ColumnLayout::create()
|
||||||
->setAxisAlignment(AxisAlignment::Start)
|
->setAxisAlignment(AxisAlignment::Start)
|
||||||
|
@ -702,6 +713,40 @@ void ModsLayer::onSettings(CCObject*) {
|
||||||
openSettingsPopup(Mod::get());
|
openSettingsPopup(Mod::get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModsLayer::onCopy(CCObject*) {
|
||||||
|
auto mods = Loader::get()->getAllMods();
|
||||||
|
if (mods.empty()) {
|
||||||
|
Notification::create("No mods installed", NotificationIcon::Info, 0.5f)->show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::sort(mods.begin(), mods.end(), [](Mod* a, Mod* b) {
|
||||||
|
auto const s1 = a->getID();
|
||||||
|
auto const s2 = b->getID();
|
||||||
|
return std::lexicographical_compare(s1.begin(), s1.end(), s2.begin(), s2.end(), [](auto a, auto b) {
|
||||||
|
return std::tolower(a) < std::tolower(b);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
std::stringstream ss;
|
||||||
|
using namespace std::string_view_literals;
|
||||||
|
for (int i = 0; i < mods.size(); i++) {
|
||||||
|
auto& mod = mods[i];
|
||||||
|
ss << fmt::format("{} | [{}] {}",
|
||||||
|
mod->isEnabled() ? "x"sv :
|
||||||
|
mod->hasProblems() ? "!"sv :
|
||||||
|
" "sv,
|
||||||
|
mod->getVersion().toVString(), mod->getID()
|
||||||
|
);
|
||||||
|
if (i != mods.size() - 1) {
|
||||||
|
ss << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clipboard::write(ss.str());
|
||||||
|
|
||||||
|
Notification::create("Mods list copied to clipboard", NotificationIcon::Info, 0.5f)->show();
|
||||||
|
}
|
||||||
|
|
||||||
ModsLayer* ModsLayer::create() {
|
ModsLayer* ModsLayer::create() {
|
||||||
auto ret = new ModsLayer();
|
auto ret = new ModsLayer();
|
||||||
if (ret->init()) {
|
if (ret->init()) {
|
||||||
|
|
|
@ -80,6 +80,7 @@ protected:
|
||||||
void onRefreshList(CCObject*);
|
void onRefreshList(CCObject*);
|
||||||
void onTheme(CCObject*);
|
void onTheme(CCObject*);
|
||||||
void onSettings(CCObject*);
|
void onSettings(CCObject*);
|
||||||
|
void onCopy(CCObject*);
|
||||||
void onBack(CCObject*);
|
void onBack(CCObject*);
|
||||||
|
|
||||||
void updateState();
|
void updateState();
|
||||||
|
|
|
@ -209,7 +209,7 @@ void SimpleTextArea::updateLinesNoWrap() {
|
||||||
|
|
||||||
void SimpleTextArea::updateLinesWordWrap(bool spaceWrap) {
|
void SimpleTextArea::updateLinesWordWrap(bool spaceWrap) {
|
||||||
this->charIteration([this, spaceWrap](CCLabelBMFont* line, const char c, const float top) {
|
this->charIteration([this, spaceWrap](CCLabelBMFont* line, const char c, const float top) {
|
||||||
static const std::string delimiters(spaceWrap ? " " : " `~!@#$%^&*()-_=+[{}];:'\",<.>/?\\|");
|
const std::string_view delimiters(spaceWrap ? " " : " `~!@#$%^&*()-_=+[{}];:'\",<.>/?\\|");
|
||||||
|
|
||||||
if (delimiters.find(c) == std::string_view::npos) {
|
if (delimiters.find(c) == std::string_view::npos) {
|
||||||
const std::string& text = line->getString();
|
const std::string& text = line->getString();
|
||||||
|
|
Loading…
Reference in a new issue