Compare commits

...

13 commits

Author SHA1 Message Date
Justin
6d0b6228f7
Merge 3222c12e90 into d0eb881ebc 2024-08-31 10:01:42 -04:00
SMJS
d0eb881ebc
Fixed a bug where only 1 word wrap variant can exist (#1058)
* Fixed a bug where only 1 word wrap variant can exist

* Made the delimiters a string view
2024-08-31 12:27:38 +02:00
Justin Pridgen
3222c12e90 texture revamp by @Alphalaneous 2024-08-19 07:38:14 -04:00
Justin Pridgen
f45b8b7128 almost forgot 2024-08-19 07:02:55 -04:00
Justin Pridgen
0da9cef29f made it slightly better 2024-08-19 07:01:50 -04:00
Justin Pridgen
9a46231420 Merge branch 'main' of https://github.com/geode-sdk/geode into copy-mods 2024-08-19 06:06:46 -04:00
Justin Pridgen
cded0523a5 it's finished holy moly 2024-08-12 18:24:27 -04:00
Justin Pridgen
2e039a9cea Merge branch 'main' of https://github.com/geode-sdk/geode into copy-mods 2024-08-09 17:21:27 -04:00
Justin Pridgen
ae24abbcec first moves oh lord 2024-08-09 17:21:14 -04:00
Justin Pridgen
9c9c75d46b Merge branch 'main' of https://github.com/geode-sdk/geode 2024-07-06 21:14:00 -04:00
Justin Pridgen
d117d50fb0 Merge branch 'main' of https://github.com/geode-sdk/geode 2024-07-06 19:41:27 -04:00
Justin Pridgen
b80efe0517 add ampersand support whoops 2024-07-04 22:59:40 -04:00
Justin Pridgen
7d40c8188f New image arguments format 2024-06-30 18:31:21 -04:00
4 changed files with 47 additions and 1 deletions

BIN
loader/resources/copy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View file

@ -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,40 @@ void ModsLayer::onSettings(CCObject*) {
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() {
auto ret = new ModsLayer();
if (ret->init()) {

View file

@ -80,6 +80,7 @@ protected:
void onRefreshList(CCObject*);
void onTheme(CCObject*);
void onSettings(CCObject*);
void onCopy(CCObject*);
void onBack(CCObject*);
void updateState();

View file

@ -209,7 +209,7 @@ void SimpleTextArea::updateLinesNoWrap() {
void SimpleTextArea::updateLinesWordWrap(bool spaceWrap) {
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) {
const std::string& text = line->getString();