Skip to content

Commit

Permalink
v1.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
hiimjasmine00 committed Jul 21, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent da0e8c9 commit 8b82bba
Showing 10 changed files with 44 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)

project(IntegratedDemonlist VERSION 1.5.2)
project(IntegratedDemonlist VERSION 1.5.3)

add_library(${PROJECT_NAME} SHARED
src/IDListLayer.cpp
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -8,5 +8,9 @@ A mod that integrates [aredl.net](https://aredl.net) and [pemonlist.com](https:/
- A button that allows you to switch between the AREDL (For classic demons) and the Pemonlist (For platformer demons).
- If on the list, and if enabled, there will be text on the demon's search box that states its position on the list.

# Gallery
![AREDL](./resources/aredl.png)\
![Pemonlist](./resources/pemonlist.png)

# License
This mod is licensed under the [MIT License](./LICENSE).
6 changes: 5 additions & 1 deletion about.md
Original file line number Diff line number Diff line change
@@ -6,4 +6,8 @@ A mod that integrates [aredl.net](https://aredl.net) and [pemonlist.com](https:/
- A search box that allows you to search for a demon in the list by name.
- Page navigation buttons that allow you to navigate through the list.
- A button that allows you to switch between the AREDL (For classic demons) and the Pemonlist (For platformer demons).
- If on the list, and if enabled, there will be text on the demon's search box that states its position on the list.
- If on the list, and if enabled, there will be text on the demon's search box that states its position on the list.

# Gallery
![AREDL](hiimjustin000.integrated_demonlist/aredl.png?scale=0.6)\
![Pemonlist](hiimjustin000.integrated_demonlist/pemonlist.png?scale=0.6)
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.3 (2024-07-20)
- Highlighted the search button when searching for a demon in the demonlist page
- Added a gallery to the mod's about page
- Fixed a bug where clicking the demonlist button would erase the search box of the level search menu

## v1.5.2 (2024-06-21)
- Fixed a bug where the demonlist page would crash the game on macOS

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.5",
"geode": "3.3.0",
"gd": {
"android": "2.206",
"win": "2.206",
"mac": "2.206"
},
"version": "v1.5.2",
"version": "v1.5.3",
"id": "hiimjustin000.integrated_demonlist",
"name": "Integrated Demonlist",
"developer": "hiimjustin000",
Binary file added resources/ID_findBtnOn_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/aredl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/pemonlist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 26 additions & 28 deletions src/IDListLayer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <random>
#include <Geode/utils/string.hpp>
#include "IDListLayer.hpp"

IDListLayer* IDListLayer::create() {
@@ -83,21 +82,21 @@ bool IDListLayer::init() {
auto refreshBtnSpr = CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png");
auto& refreshBtnSize = refreshBtnSpr->getContentSize();
auto refreshButton = CCMenuItemExt::createSpriteExtra(refreshBtnSpr, [this](auto) {
if (PEMONLIST) IntegratedDemonlist::loadPemonlist(std::move(m_listener), [this]() { populateList(m_query); });
else IntegratedDemonlist::loadAREDL(std::move(m_listener), [this]() { populateList(m_query); });
if (PEMONLIST) IntegratedDemonlist::loadPemonlist(std::move(m_listener), [this] { populateList(m_query); });
else IntegratedDemonlist::loadAREDL(std::move(m_listener), [this] { populateList(m_query); });
});
refreshButton->setPosition(winSize.width - refreshBtnSize.width / 2 - 4.0f, refreshBtnSize.height / 2 + 4.0f);
menu->addChild(refreshButton, 2);

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); });
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); });
IntegratedDemonlist::loadAREDL(std::move(m_listener), [this] { page(0); });
m_infoButton->m_title = "All Rated Extreme Demons List";
m_infoButton->m_description = AREDL_INFO;
}
@@ -120,14 +119,9 @@ bool IDListLayer::init() {
m_pageButton->setPositionY(winSize.height - 39.5f);
menu->addChild(m_pageButton);
// Sprite by Cvolton
auto randomBtnSpr = CCSprite::create("BI_randomBtn_001.png"_spr);
randomBtnSpr->setScale(0.9f);
m_randomButton = CCMenuItemExt::createSpriteExtra(randomBtnSpr, [this](auto) {
std::random_device os_seed;
const unsigned int seed = os_seed();
std::mt19937 generator(seed);
std::uniform_int_distribution<int> distribute(0, getMaxPage());
page(distribute(generator));
m_randomButton = CCMenuItemExt::createSpriteExtraWithFilename("BI_randomBtn_001.png"_spr, 0.9f, [this](auto) {
static std::mt19937 mt(std::random_device{}());
page(std::uniform_int_distribution<int>(0, getMaxPage())(mt));
});
m_randomButton->setPositionY(m_pageButton->getPositionY() - m_pageButton->getContentSize().height / 2 - m_randomButton->getContentSize().height / 2 - 5.0f);
menu->addChild(m_randomButton);
@@ -173,10 +167,10 @@ bool IDListLayer::init() {
setKeyboardEnabled(true);
if (PEMONLIST) {
if (!IntegratedDemonlist::PEMONLIST.empty()) populateList("");
else IntegratedDemonlist::loadPemonlist(std::move(m_listener), [this]() { 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 IntegratedDemonlist::loadAREDL(std::move(m_listener), [this] { populateList(""); });

return true;
}
@@ -191,11 +185,15 @@ void IDListLayer::addSearchBar() {

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(); });
searchButton->setPosition(337.0f, 15.0f);
m_searchBarMenu->addChild(searchButton);
if (!m_query.empty()) {
auto searchButton = CCMenuItemExt::createSpriteExtraWithFilename("ID_findBtnOn_001.png"_spr, 0.7f, [this](auto) { search(); });
searchButton->setPosition(337.0f, 15.0f);
m_searchBarMenu->addChild(searchButton);
} else {
auto searchButton = CCMenuItemExt::createSpriteExtraWithFrameName("gj_findBtn_001.png", 0.7f, [this](auto) { search(); });
searchButton->setPosition(337.0f, 15.0f);
m_searchBarMenu->addChild(searchButton);
}

m_searchBar = TextInput::create(413.3f, "Search Demons...");
m_searchBar->setCommonFilter(CommonFilter::Any);
@@ -228,14 +226,14 @@ void IDListLayer::populateList(std::string query) {
for (auto const& level : list) {
if (string::startsWith(string::toLower(level.name), queryLowercase)) m_fullSearchResults.push_back(std::to_string(level.id));
}
}
m_query = query;
if (query.empty()) {
} else {
for (auto const& level : list) {
m_fullSearchResults.push_back(std::to_string(level.id));
}
}

m_query = query;

if (m_fullSearchResults.empty()) {
loadLevelsFinished(CCArray::create(), "");
m_countLabel->setString("");
@@ -244,7 +242,7 @@ void IDListLayer::populateList(std::string query) {
auto glm = GameLevelManager::sharedState();
glm->m_levelManagerDelegate = this;
auto searchResults = std::vector<std::string>(m_fullSearchResults.begin() + m_page * 10,
m_fullSearchResults.begin() + std::min(static_cast<int>(m_fullSearchResults.size()), (m_page + 1) * 10));
m_fullSearchResults.begin() + std::min((int)m_fullSearchResults.size(), (m_page + 1) * 10));
auto searchObject = GJSearchObject::create(SearchType::MapPackOnClick, string::join(searchResults, ","));
auto storedLevels = glm->getStoredOnlineLevels(searchObject->getKey());
if (storedLevels) {
@@ -292,17 +290,17 @@ void IDListLayer::loadLevelsFailed(const char*) {

void IDListLayer::setupPageInfo(gd::string, const char*) {
m_countLabel->setString(fmt::format("{} to {} of {}", m_page * 10 + 1,
std::min(static_cast<int>(m_fullSearchResults.size()), (m_page + 1) * 10), m_fullSearchResults.size()).c_str());
std::min((int)m_fullSearchResults.size(), (m_page + 1) * 10), m_fullSearchResults.size()).c_str());
m_countLabel->limitLabelWidth(100.0f, 0.6f, 0.0f);
}

void IDListLayer::search() {
if (m_query != m_searchBarText) {
if (PEMONLIST) IntegratedDemonlist::loadPemonlist(std::move(m_listener), [this]() {
if (PEMONLIST) IntegratedDemonlist::loadPemonlist(std::move(m_listener), [this] {
m_page = 0;
populateList(m_searchBarText);
});
else IntegratedDemonlist::loadAREDL(std::move(m_listener), [this]() {
else IntegratedDemonlist::loadAREDL(std::move(m_listener), [this] {
m_page = 0;
populateList(m_searchBarText);
});
@@ -337,7 +335,7 @@ void IDListLayer::keyDown(enumKeyCodes key) {
}

void IDListLayer::keyBackClicked() {
CCDirector::sharedDirector()->replaceScene(CCTransitionFade::create(0.5f, LevelSearchLayer::scene(GameManager::sharedState()->m_unkSize4_17)));
CCDirector::sharedDirector()->popSceneWithTransition(0.5f, kPopTransitionFade);
}

void IDListLayer::setIDPopupClosed(SetIDPopup*, int page) {
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ class $modify(IDLevelSearchLayer, LevelSearchLayer) {
auto demonlistButtonSprite = CircleButtonSprite::createWithSpriteFrameName("diffIcon_10_btn_001.png", 1.0f, CircleBaseColor::Pink, CircleBaseSize::Medium);
demonlistButtonSprite->setScale(0.8f);
auto demonlistButton = CCMenuItemExt::createSpriteExtra(demonlistButtonSprite, [](auto) {
CCDirector::sharedDirector()->replaceScene(CCTransitionFade::create(0.5f, IDListLayer::scene()));
CCDirector::sharedDirector()->pushScene(CCTransitionFade::create(0.5f, IDListLayer::scene()));
});
demonlistButton->setID("demonlist-button"_spr);
auto menu = getChildByID("other-filter-menu");

0 comments on commit 8b82bba

Please sign in to comment.