Skip to content

Commit

Permalink
starting work on pack list
Browse files Browse the repository at this point in the history
  • Loading branch information
LimeGradient committed Sep 26, 2024
1 parent 9b80dab commit a04c043
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ModpackInfoPopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ bool ModpackInfoPopup::setup() {
m_chooseLogoBtn->setID("choose-logo-button");
menu->addChildAtPosition(m_chooseLogoBtn, Anchor::Center, ccp(0.f, -60.f));

m_logoPathText = CCLabelBMFont::create("Logo Path:", "bigFont.fnt");
m_logoPathText->setScale(0.25f);
m_logoPathText->setID("logo-path-text");
menu->addChildAtPosition(m_logoPathText, Anchor::Center, ccp(0.f, -100.f));

auto createPackSpr = ButtonSprite::create("Create Pack", "bigFont.fnt", "geode-button.png"_spr);
createPackSpr->setScale(0.65f);
m_createPackBtn = CCMenuItemSpriteExtra::create(
Expand All @@ -78,7 +83,8 @@ void ModpackInfoPopup::getLogo(FileTask::Event* e) {
if (auto result = e->getValue()) {
if (result->isOk()) {
auto path = result->unwrap();
m_packInfo->logo = path;
m_packInfo->logo = path.string();
m_logoPathText->setString(fmt::format("Logo Path: {}", path.string()).c_str());
}
} else if (e->isCancelled()) {
geode::Notification::create("File Operation Cancelled", geode::NotificationIcon::Error)->show();
Expand All @@ -104,6 +110,7 @@ void ModpackInfoPopup::onCreatePack(CCObject* sender) {
exportProfilesList->exportProfile(e, m_packInfo);
});
m_fileTaskListener.setFilter(exportToFile());
this->onClose(new CCObject());
}

ModpackInfoPopup* ModpackInfoPopup::create() {
Expand Down
1 change: 1 addition & 0 deletions src/ModpackInfoPopup.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class ModpackInfoPopup : public geode::Popup<> {
TextInput* m_modpackAuthor;
TextInput* m_modpackDescription;
CCMenuItemSpriteExtra* m_chooseLogoBtn;
CCLabelBMFont* m_logoPathText;
CCMenuItemSpriteExtra* m_createPackBtn;

PackInfo* m_packInfo;
Expand Down
4 changes: 4 additions & 0 deletions src/lists/ExportProfilesList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ void ExportProfilesList::exportProfile(FileTask::Event* e, PackInfo* packInfo) {
packJson["author"] = (packInfo->author.empty()) ? "A wonderful user" : packInfo->author;
packJson["hasLocalMods"] = packInfo->includesLocalMods;

if (!packInfo->logo.empty()) {
zip->appendToZip("logo.png", packInfo->logo);
}

zip->writeStringToZip("pack.json", packJson.dump());
zip->close();

Expand Down
1 change: 1 addition & 0 deletions src/lists/PackCell.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "PackCell.h"
3 changes: 3 additions & 0 deletions src/lists/PackCell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <Geode/Geode.hpp>

using namespace geode::prelude;
1 change: 1 addition & 0 deletions src/lists/PackSelectList.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "PackSelectList.h"
3 changes: 3 additions & 0 deletions src/lists/PackSelectList.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <Geode/Geode.hpp>

using namespace geode::prelude;

0 comments on commit a04c043

Please sign in to comment.