Skip to content

Commit f86edb5

Browse files
committed
Made the popup way better, bumped geode v
1 parent 93aadc6 commit f86edb5

2 files changed

Lines changed: 26 additions & 23 deletions

File tree

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"geode": "5.3.0",
2+
"geode": "5.4.1",
33
"gd": {
44
"win": "2.2081",
55
"mac": "2.2081",

src/main.cpp

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
using namespace geode::prelude;
88

9-
class MyPopup : public geode::Popup {
9+
class WraithHelperPopup : public geode::Popup {
1010
protected:
1111
async::TaskHolder<geode::utils::web::WebResponse> m_listener;
1212
size_t m_currentPage = 0;
@@ -37,7 +37,7 @@ class MyPopup : public geode::Popup {
3737
bool init() {
3838
if (!Popup::init(330.f, 270.f)) return false;
3939

40-
this->setTitle("Wraith helper");
40+
this->setTitle("Wraith Helper");
4141

4242
m_contentMenu = CCMenu::create();
4343
m_contentMenu->setContentSize({ m_size.width - 4.f, 140.f });
@@ -55,8 +55,8 @@ class MyPopup : public geode::Popup {
5555
void updatePageUI() {
5656
auto totalItems = m_keys.size();
5757
if (totalItems == 0) {
58-
if (m_titleLabel) m_titleLabel->setString("Loading...");
59-
if (m_codeLabel) m_codeLabel->setString("Loading...");
58+
if (m_titleLabel) m_titleLabel->setString("...");
59+
if (m_codeLabel) m_codeLabel->setString("...");
6060
if (m_pageLabel) m_pageLabel->setString("Page 0/0");
6161
if (m_contentMenu) m_contentMenu->removeAllChildren();
6262
if (m_progressLabel) m_progressLabel->setString("0/0");
@@ -71,7 +71,7 @@ class MyPopup : public geode::Popup {
7171

7272
float containerW = m_contentMenu ? m_contentMenu->getContentSize().width : (m_size.width - 4.f);
7373
float yTop = (m_contentMenu ? m_contentMenu->getContentSize().height : 140.f) + 20.f;
74-
float lineH = 28.f;
74+
float lineH = 35.f;
7575

7676
for (size_t i = start; i < end; ++i) {
7777
auto const& key = m_keys[i];
@@ -104,19 +104,19 @@ class MyPopup : public geode::Popup {
104104

105105
auto infoSprite = CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png");
106106
infoSprite->setScale(0.7f);
107-
auto infoBtn = CCMenuItemSpriteExtra::create(infoSprite, this, menu_selector(MyPopup::onInfo));
107+
auto infoBtn = CCMenuItemSpriteExtra::create(infoSprite, this, menu_selector(WraithHelperPopup::onInfo));
108108
infoBtn->setTag(static_cast<int>(i));
109-
float infoX = leftX + codeLabel->getScaledContentSize().width + 8.f;
109+
float infoX = leftX + codeLabel->getScaledContentSize().width + 11.f;
110110
infoBtn->setPosition({infoX, y});
111111
m_contentMenu->addChild(infoBtn);
112112

113-
auto inputBtn = CCMenuItemSpriteExtra::create(inputSprite, this, menu_selector(MyPopup::onApplyCode));
113+
auto inputBtn = CCMenuItemSpriteExtra::create(inputSprite, this, menu_selector(WraithHelperPopup::onApplyCode));
114114
inputBtn->setTag(static_cast<int>(i));
115115
inputBtn->setPosition({rightX, y});
116116
if (claimed) {
117117
inputBtn->setEnabled(false);
118118
inputBtn->setOpacity(160);
119-
inputSprite->setColor(ccColor3B{150,255,170});
119+
inputSprite->setColor(ccColor3B{ 0, 255, 47 });
120120
}
121121
m_contentMenu->addChild(inputBtn);
122122
}
@@ -184,7 +184,7 @@ class MyPopup : public geode::Popup {
184184
auto body = res.string().unwrapOr("");
185185
auto parsed = matjson::parse(body);
186186
if (!parsed) {
187-
log::error("JSON failed (interesting reset your dns pls)): {}", parsed.unwrapErr());
187+
log::error("JSON failed (interesting, reset your dns pls)): {}", parsed.unwrapErr());
188188
return;
189189
}
190190
auto json = parsed.unwrap();
@@ -209,14 +209,14 @@ class MyPopup : public geode::Popup {
209209
}
210210
void setupPaginationControls() {
211211
auto paginationMenu = CCMenu::create();
212-
paginationMenu->setContentSize({300.f, 40.f});
212+
paginationMenu->setContentSize({getContentSize().width - 30.f, 40.f});
213213
paginationMenu->ignoreAnchorPointForPosition(false);
214214
paginationMenu->setAnchorPoint({0.5f, 0.5f});
215-
paginationMenu->setPosition({m_size.width / 2, 40.f});
215+
paginationMenu->setPosition({m_size.width / 2.f, 39.f});
216216

217217
paginationMenu->setLayout(RowLayout::create()
218218
->setAxisAlignment(AxisAlignment::Center)
219-
->setGap(20.f)
219+
->setGap(14.f)
220220
);
221221

222222
auto prevSprite = CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
@@ -225,7 +225,7 @@ class MyPopup : public geode::Popup {
225225
m_prevBtn = CCMenuItemSpriteExtra::create(
226226
prevSprite,
227227
this,
228-
menu_selector(MyPopup::onPrevButton)
228+
menu_selector(WraithHelperPopup::onPrevButton)
229229
);
230230

231231
auto nextSprite = CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
@@ -234,22 +234,25 @@ class MyPopup : public geode::Popup {
234234
m_nextBtn = CCMenuItemSpriteExtra::create(
235235
nextSprite,
236236
this,
237-
menu_selector(MyPopup::onNextButton)
237+
menu_selector(WraithHelperPopup::onNextButton)
238238
);
239239

240240
paginationMenu->addChild(m_prevBtn);
241-
paginationMenu->addChild(m_nextBtn);
242241

243242
m_pageLabel = CCLabelBMFont::create("Page 0/0", "bigFont.fnt");
244243
m_pageLabel->setScale(0.35f);
245244
paginationMenu->addChild(m_pageLabel);
246245

247-
m_progressLabel = CCLabelBMFont::create("0/0", "goldFont.fnt");
248-
m_progressLabel->setScale(0.35f);
249-
paginationMenu->addChild(m_progressLabel);
246+
paginationMenu->addChild(m_nextBtn);
250247

251248
paginationMenu->updateLayout();
252249
m_mainLayer->addChild(paginationMenu);
250+
251+
m_progressLabel = CCLabelBMFont::create("0/0", "goldFont.fnt");
252+
m_progressLabel->setScale(1.f);
253+
m_progressLabel->setAnchorPoint({1.f, 1.f});
254+
m_progressLabel->setPosition({m_size.width - 15.f, m_size.height - 5.f});
255+
m_mainLayer->addChild(m_progressLabel);
253256
}
254257
void onNextButton(CCObject*) {
255258
auto pages = totalPages();
@@ -302,8 +305,8 @@ class MyPopup : public geode::Popup {
302305
m_progressLabel->setString(s.c_str());
303306
}
304307
public:
305-
static MyPopup* create() {
306-
auto ret = new MyPopup();
308+
static WraithHelperPopup* create() {
309+
auto ret = new WraithHelperPopup();
307310
ret->m_bgSprite = NineSlice::create("GJ_square07.png");
308311
if (ret->init()) {
309312
ret->autorelease();
@@ -337,6 +340,6 @@ class $modify(MySecretLayer5, SecretLayer5) {
337340
return true;
338341
}
339342
void onMyButton(CCObject*) {
340-
MyPopup::create()->show();
343+
WraithHelperPopup::create()->show();
341344
}
342345
};

0 commit comments

Comments
 (0)