Skip to content

Commit

Permalink
v1.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hiimjustin000 committed Jun 21, 2024
1 parent ed954f5 commit 55ad17c
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
with:
build-config: RelWithDebInfo
export-pdb: true
sdk: v3.0.0-beta.1
sdk: v3.0.0-beta.4
combine: true
target: ${{ matrix.config.target }}

Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)

project(IntegratedDemonlist VERSION 1.5.0)
project(IntegratedDemonlist VERSION 1.5.1)

add_library(${PROJECT_NAME} SHARED
src/IDListLayer.cpp
src/main.cpp
src/IntegratedDemonlist.cpp
src/main.cpp
)

if (NOT DEFINED ENV{GEODE_SDK})
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Integrated Demonlist Changelog
## v1.5.1 (2024-06-20)
- Tweaked the UI of the demonlist page
- Fixed a bug where the refresh button would empty the list
- Fixed a bug where legacy demons would appear in the demonlist and two-player demons would appear twice

## v1.5.0 (2024-06-19)
- Added Pemonlist support
- Fixed a bug where the list would not load if the main menu was exited too quickly
Expand Down
4 changes: 2 additions & 2 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"geode": "3.0.0-beta.1",
"geode": "3.0.0-beta.4",
"gd": {
"android": "2.206",
"win": "2.206",
"mac": "2.206"
},
"version": "v1.5.0",
"version": "v1.5.1",
"id": "hiimjustin000.integrated_demonlist",
"name": "Integrated Demonlist",
"developer": "hiimjustin000",
Expand Down
150 changes: 63 additions & 87 deletions src/IDListLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,6 @@ bool IDListLayer::init() {

addSearchBar();

m_searchBar = CCTextInputNode::create(340.0f, 30.0f, "Search Demons...", "bigFont.fnt");
m_searchBar->setAllowedChars(" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~");
m_searchBar->setLabelPlaceholderColor({ 150, 150, 150 });
m_searchBar->setLabelPlaceholderScale(0.4f);
m_searchBar->setMaxLabelScale(0.4f);
m_searchBar->m_textField->setAnchorPoint({ 0.0f, 0.5f });
m_searchBar->m_placeholderLabel->setAnchorPoint({ 0.0f, 0.5f });
m_searchBar->setPosition(winSize.width / 2 - 160.f, winSize.height / 2 + 95.f);
m_searchBar->setZOrder(60);
addChild(m_searchBar);

auto menu = CCMenu::create();
menu->setPosition(0.0f, 0.0f);
addChild(menu);
Expand All @@ -87,16 +76,9 @@ bool IDListLayer::init() {
m_rightButton->setPosition(winSize.width - 24.0f, winSize.height / 2);
menu->addChild(m_rightButton);

auto infoButton = CCMenuItemExt::createSpriteExtraWithFrameName("GJ_infoIcon_001.png", 1.0f, [](auto) {
FLAlertLayer::create(PEMONLIST ? "Pemonlist" : "AREDL", PEMONLIST ?
"The <cg>Pemonlist</c> is an unofficial ranking of all rated <cj>platformer mode</c> <cr>Demons</c> in Geometry Dash.\n"
"It is managed by <cy>camila314</c>, <cy>Extatica</c>, and <cy>mariokirby1703</c>." :
"The <cg>All Rated Extreme Demons List</c> (AREDL) is an unofficial ranking of all rated <cj>classic mode</c> <cr>Extreme Demons</c> in Geometry Dash.\n"
"It is managed by <cy>iiLogan</c>, <cy>SEDTHEPRODIGY</c>, <cy>Megu</c>, and <cy>Minebox260</c>.",
"OK")->show();
});
infoButton->setPosition(30.0f, 30.0f);
menu->addChild(infoButton, 2);
m_infoButton = InfoAlertButton::create(PEMONLIST ? "Pemonlist" : "All Rated Extreme Demons List", PEMONLIST ? PEMONLIST_INFO : AREDL_INFO, 1.0f);
m_infoButton->setPosition(30.0f, 30.0f);
menu->addChild(m_infoButton, 2);

auto refreshBtnSpr = CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png");
auto& refreshBtnSize = refreshBtnSpr->getContentSize();
Expand All @@ -109,8 +91,16 @@ bool IDListLayer::init() {

auto listToggler = CCMenuItemExt::createTogglerWithFrameName("GJ_moonsIcon_001.png", "GJ_starsIcon_001.png", 1.1f, [this](auto) {
PEMONLIST = !PEMONLIST;
if (PEMONLIST) IntegratedDemonlist::loadPemonlist(std::move(m_listener), [this]() { page(0); });
else IntegratedDemonlist::loadAREDL(std::move(m_listener), [this]() { page(0); });
if (PEMONLIST) {
IntegratedDemonlist::loadPemonlist(std::move(m_listener), [this]() { page(0); });
m_infoButton->m_title = "Pemonlist";
m_infoButton->m_description = PEMONLIST_INFO;
}
else {
IntegratedDemonlist::loadAREDL(std::move(m_listener), [this]() { page(0); });
m_infoButton->m_title = "All Rated Extreme Demons List";
m_infoButton->m_description = AREDL_INFO;
}
});
listToggler->toggle(PEMONLIST);
listToggler->setPosition(30.0f, 60.0f);
Expand Down Expand Up @@ -141,38 +131,29 @@ bool IDListLayer::init() {
});
m_randomButton->setPositionY(m_pageButton->getPositionY() - m_pageButton->getContentSize().height / 2 - m_randomButton->getContentSize().height / 2 - 5.0f);
menu->addChild(m_randomButton);
// oh boy
// https://github.com/Cvolton/betterinfo-geode/blob/v4.0.0/src/hooks/LevelBrowserLayer.cpp#L118
auto firstArrow = CCSprite::createWithSpriteFrameName("GJ_arrow_02_001.png");
firstArrow->setPosition({ 35, 25 });
firstArrow->setFlipX(true);
auto secondArrow = CCSprite::createWithSpriteFrameName("GJ_arrow_02_001.png");
secondArrow->setPosition({ 15, 25 });
secondArrow->setFlipX(true);
auto arrowParent = CCNode::create();
arrowParent->setContentSize({ 50, 50 });
arrowParent->addChild(firstArrow);
arrowParent->addChild(secondArrow);
arrowParent->setScale(0.4f);
m_lastButton = CCMenuItemExt::createSpriteExtra(arrowParent, [this](auto) { page(getMaxPage()); });
m_lastButton->setPositionY(m_randomButton->getPositionY() - m_randomButton->getContentSize().height / 2 - m_lastButton->getContentSize().height / 2 - 2.0f);

auto lastArrow = CCSprite::createWithSpriteFrameName("GJ_arrow_02_001.png");
lastArrow->setFlipX(true);
auto otherLastArrow = CCSprite::createWithSpriteFrameName("GJ_arrow_02_001.png");
otherLastArrow->setPosition(lastArrow->getContentSize() / 2 + CCPoint { 20.0f, 0.0f });
otherLastArrow->setFlipX(true);
lastArrow->addChild(otherLastArrow);
lastArrow->setScale(0.4f);
m_lastButton = CCMenuItemExt::createSpriteExtra(lastArrow, [this](auto) { page(getMaxPage()); });
m_lastButton->setPositionY(m_randomButton->getPositionY() - m_randomButton->getContentSize().height / 2 - m_lastButton->getContentSize().height / 2 - 5.0f);
menu->addChild(m_lastButton);
auto x = winSize.width - 3.0f - m_randomButton->getContentSize().width / 2;
auto x = winSize.width - m_randomButton->getContentSize().width / 2 - 3.0f;
m_pageButton->setPositionX(x);
m_randomButton->setPositionX(x);
m_lastButton->setPositionX(x);
// https://github.com/Cvolton/betterinfo-geode/blob/v4.0.0/src/hooks/LevelBrowserLayer.cpp#L164
m_lastButton->setPositionX(x - 4.0f);

auto firstArrow = CCSprite::createWithSpriteFrameName("GJ_arrow_02_001.png");
auto otherFirstArrow = CCSprite::createWithSpriteFrameName("GJ_arrow_02_001.png");
otherFirstArrow->setPosition({ 35, 34.5 });
auto otherSecondArrow = CCSprite::createWithSpriteFrameName("GJ_arrow_02_001.png");
otherSecondArrow->setPosition({ 15, 34.5 });
auto otherArrowParent = CCNode::create();
otherArrowParent->setContentSize({ 50, 69 });
otherArrowParent->addChild(otherFirstArrow);
otherArrowParent->addChild(otherSecondArrow);
otherArrowParent->setScale(0.4f);
m_firstButton = CCMenuItemExt::createSpriteExtra(otherArrowParent, [this](auto) { page(0); });
m_firstButton->setPosition(17.5f, winSize.height - 64.0f);
otherFirstArrow->setPosition(firstArrow->getContentSize() / 2 - CCPoint { 20.0f, 0.0f });
firstArrow->addChild(otherFirstArrow);
firstArrow->setScale(0.4f);
m_firstButton = CCMenuItemExt::createSpriteExtra(firstArrow, [this](auto) { page(0); });
m_firstButton->setPosition(21.5f, m_lastButton->getPositionY());
menu->addChild(m_firstButton);

m_loadingCircle = LoadingCircle::create();
Expand All @@ -181,8 +162,7 @@ bool IDListLayer::init() {
m_loadingCircle->show();
m_loadingCircle->setVisible(false);

m_searchBarView->setVisible(false);
m_searchBar->setVisible(false);
m_searchBarMenu->setVisible(false);
m_leftButton->setVisible(false);
m_rightButton->setVisible(false);
m_firstButton->setVisible(false);
Expand All @@ -195,42 +175,44 @@ bool IDListLayer::init() {
if (!IntegratedDemonlist::PEMONLIST.empty()) populateList("");
else IntegratedDemonlist::loadPemonlist(std::move(m_listener), [this]() { populateList(""); });
}
else {
if (!IntegratedDemonlist::AREDL.empty()) populateList("");
else IntegratedDemonlist::loadAREDL(std::move(m_listener), [this]() { populateList(""); });
}
else if (!IntegratedDemonlist::AREDL.empty()) populateList("");
else IntegratedDemonlist::loadAREDL(std::move(m_listener), [this]() { populateList(""); });

return true;
}

void IDListLayer::addSearchBar() {
auto winSize = CCDirector::sharedDirector()->getWinSize();

m_searchBarView = CCLayerColor::create({ 194, 114, 62, 255 }, 358.0f, 30.0f);
m_searchBarView->setPosition(0.0f, 190.0f);
auto searchBarMenu = CCMenu::create();
searchBarMenu->setPosition(337.0f, 15.0f);
m_searchBarMenu = CCMenu::create();
m_searchBarMenu->setContentSize({ 358.0f, 30.0f });
m_searchBarMenu->setPosition(0.0f, 190.0f);
m_list->addChild(m_searchBarMenu);

m_searchBarMenu->addChild(CCLayerColor::create({ 194, 114, 62, 255 }, 358.0f, 30.0f));

auto searchButtonSpr = CCSprite::createWithSpriteFrameName("gj_findBtn_001.png");
searchButtonSpr->setScale(0.7f);
auto searchButton = CCMenuItemExt::createSpriteExtra(searchButtonSpr, [this](auto) { search(); });
searchBarMenu->addChild(searchButton);
auto searchBarBg = CCScale9Sprite::create("square02b_001.png", { 0.0f, 0.0f, 80.0f, 80.0f });
searchBarBg->setPosition(165.0f, 15.0f);
searchBarBg->setContentSize({ 620.0f, 40.0f });
searchBarBg->setColor({ 126, 59, 7 });
searchBarBg->setScale(0.5f);
m_searchBarView->addChild(searchBarMenu);
m_searchBarView->addChild(searchBarBg);

m_list->addChild(m_searchBarView);
searchButton->setPosition(337.0f, 15.0f);
m_searchBarMenu->addChild(searchButton);

m_searchBar = TextInput::create(413.3f, "Search Demons...");
m_searchBar->setCommonFilter(CommonFilter::Any);
m_searchBar->setPosition(165.0f, 15.0f);
m_searchBar->setTextAlign(TextInputAlign::Left);
m_searchBar->getInputNode()->setLabelPlaceholderScale(0.53f);
m_searchBar->getInputNode()->setMaxLabelScale(0.53f);
m_searchBar->setScale(0.75f);
m_searchBar->setCallback([this](std::string const& text) { m_searchBarText = text; });
m_searchBarMenu->addChild(m_searchBar);
}

void IDListLayer::populateList(std::string query) {
m_pageLabel->setString(std::to_string(m_page + 1).c_str());
m_loadingCircle->setVisible(true);
m_list->m_listView->setVisible(false);
m_searchBarView->setVisible(false);
m_searchBar->setVisible(false);
m_searchBarMenu->setVisible(false);
m_countLabel->setVisible(false);
m_leftButton->setVisible(false);
m_rightButton->setVisible(false);
Expand All @@ -241,7 +223,7 @@ void IDListLayer::populateList(std::string query) {
m_fullSearchResults.clear();

auto& list = PEMONLIST ? IntegratedDemonlist::PEMONLIST : IntegratedDemonlist::AREDL;
if (query != m_query && !query.empty()) {
if (!query.empty()) {
auto queryLowercase = string::toLower(query);
for (auto const& level : list) {
if (string::startsWith(string::toLower(level.name), queryLowercase)) m_fullSearchResults.push_back(std::to_string(level.id));
Expand Down Expand Up @@ -287,7 +269,7 @@ void IDListLayer::loadLevelsFinished(CCArray* levels, const char*) {
m_list->setPosition(winSize / 2 - m_list->getContentSize() / 2);
addChild(m_list);
addSearchBar();
m_searchBar->setVisible(true);
m_searchBar->setString(m_searchBarText);
m_countLabel->setVisible(true);
m_loadingCircle->setVisible(false);
if (m_fullSearchResults.size() > 10) {
Expand All @@ -302,8 +284,7 @@ void IDListLayer::loadLevelsFinished(CCArray* levels, const char*) {
}

void IDListLayer::loadLevelsFailed(const char*) {
m_searchBar->setVisible(true);
m_searchBarView->setVisible(true);
m_searchBarMenu->setVisible(true);
m_countLabel->setVisible(true);
m_loadingCircle->setVisible(false);
FLAlertLayer::create("Load Failed", "Failed to load levels. Please try again later.", "OK")->show();
Expand All @@ -316,15 +297,14 @@ void IDListLayer::setupPageInfo(gd::string, const char*) {
}

void IDListLayer::search() {
auto searchString = m_searchBar->getString();
if (m_query != searchString) {
if (PEMONLIST) IntegratedDemonlist::loadPemonlist(std::move(m_listener), [this, searchString]() {
if (m_query != m_searchBarText) {
if (PEMONLIST) IntegratedDemonlist::loadPemonlist(std::move(m_listener), [this]() {
m_page = 0;
populateList(searchString);
populateList(m_searchBarText);
});
else IntegratedDemonlist::loadAREDL(std::move(m_listener), [this, searchString]() {
else IntegratedDemonlist::loadAREDL(std::move(m_listener), [this]() {
m_page = 0;
populateList(searchString);
populateList(m_searchBarText);
});
}
}
Expand All @@ -335,10 +315,6 @@ void IDListLayer::page(int page) {
populateList(m_query);
}

void IDListLayer::deselectKeyboard() {
m_searchBar->onClickTrackNode(false);
}

void IDListLayer::keyDown(enumKeyCodes key) {
switch (key)
{
Expand Down
13 changes: 10 additions & 3 deletions src/IDListLayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
class IDListLayer : public CCLayer, SetIDPopupDelegate, LevelManagerDelegate {
private:
inline static bool PEMONLIST = false;
inline static const char* AREDL_INFO =
"The <cg>All Rated Extreme Demons List</c> (<cg>AREDL</c>) is an <cp>unofficial ranking</c> of all rated <cj>classic mode</c> <cr>extreme demons</c> in Geometry Dash.\n"
"It is managed by <cy>iiLogan</c>, <cy>SEDTHEPRODIGY</c>, <cy>Megu</c>, and <cy>Minebox260</c>.";
inline static const char* PEMONLIST_INFO =
"The <cg>Pemonlist</c> is an <cp>unofficial ranking</c> of all rated <cj>platformer mode</c> <cr>demons</c> in Geometry Dash.\n"
"It is managed by <cy>camila314</c>, <cy>Extatica</c>, and <cy>mariokirby1703</c>.";
public:
static IDListLayer* create();
static CCScene* scene();

void search();
void page(int);
void deselectKeyboard();
void keyDown(enumKeyCodes) override;
void keyBackClicked() override;

Expand All @@ -19,10 +24,11 @@ class IDListLayer : public CCLayer, SetIDPopupDelegate, LevelManagerDelegate {
GJListLayer* m_list;
CCLabelBMFont* m_listLabel;
LoadingCircle* m_loadingCircle;
CCLayerColor* m_searchBarView;
CCTextInputNode* m_searchBar;
CCMenu* m_searchBarMenu;
TextInput* m_searchBar;
CCLabelBMFont* m_countLabel;
CCLabelBMFont* m_pageLabel;
InfoAlertButton* m_infoButton;
CCMenuItemSpriteExtra* m_backButton;
CCMenuItemSpriteExtra* m_leftButton;
CCMenuItemSpriteExtra* m_rightButton;
Expand All @@ -32,6 +38,7 @@ class IDListLayer : public CCLayer, SetIDPopupDelegate, LevelManagerDelegate {
CCMenuItemSpriteExtra* m_lastButton;
int m_page = 0;
std::string m_query = "";
std::string m_searchBarText = "";
std::vector<std::string> m_fullSearchResults;

bool init() override;
Expand Down
2 changes: 1 addition & 1 deletion src/IntegratedDemonlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ void IntegratedDemonlist::initializeDemons(web::WebResponse* res, bool pemonlist
auto& list = pemonlist ? PEMONLIST : AREDL;
list.clear();
for (auto const& level : res->json().value().as_array()) {
list.push_back({
if (pemonlist || ((!level.contains("legacy") || !level["legacy"].as_bool()) && !level["two_player"].as_bool())) list.push_back({
level["level_id"].as_int(),
level["name"].as_string(),
level[pemonlist ? "placement" : "position"].as_int()
Expand Down
9 changes: 0 additions & 9 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,6 @@ class $modify(IDLevelSearchLayer, LevelSearchLayer) {
// https://github.com/Cvolton/betterinfo-geode/blob/v4.0.0/src/hooks/LevelCell.cpp#L113
#include <Geode/modify/LevelCell.hpp>
class $modify(IDLevelCell, LevelCell) {
void onClick(CCObject* sender) {
LevelCell::onClick(sender);

if (!m_tableView) return;

auto layer = m_tableView->getParent()->getParent()->getParent();
if (layer->getID() == "IDListLayer") static_cast<IDListLayer*>(layer)->deselectKeyboard();
}

void loadCustomLevelCell() {
LevelCell::loadCustomLevelCell();

Expand Down

0 comments on commit 55ad17c

Please sign in to comment.