Skip to content

Commit

Permalink
v1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hiimjustin000 committed Mar 10, 2024
1 parent 66caf24 commit 5c1fb4a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
- name: Windows
os: windows-latest

- name: macOS
os: macos-latest

- name: Android32
os: ubuntu-latest
target: Android32
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Integrated Demonlist Changelog
## v1.4.2 (2024-03-08)
- Fixed the randomize button on the demonlist page

## v1.4.1 (2024-03-06)
- Added the demonlist to the list search menu

Expand Down
6 changes: 3 additions & 3 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"geode": "2.0.0-beta.20",
"geode": "2.0.0-beta.21",
"gd": {
"android": "2.205",
"win": "2.204",
"mac": "2.200"
},
"version": "v1.4.1",
"version": "v1.4.2",
"id": "hiimjustin000.integrated_demonlist",
"name": "Integrated Demonlist",
"developer": "hiimjustin000",
Expand Down Expand Up @@ -33,7 +33,7 @@
"dependencies": [
{
"id": "geode.node-ids",
"version": ">=v1.6.1",
"version": ">=v1.7.1",
"importance": "required"
}
]
Expand Down
25 changes: 7 additions & 18 deletions src/IDListLayer.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "IDListLayer.hpp"
#include <random>
#include <Geode/utils/web.hpp>

template<typename T>
Expand All @@ -19,21 +20,6 @@ std::string join(std::vector<int> const& vec, std::string const& delim) {
return ret;
}

std::vector<std::string> split(std::string const& str, std::string const& delim) {
size_t pos_start = 0, pos_end, delim_len = delim.length();
std::string token;
std::vector<std::string> res;

while ((pos_end = str.find(delim, pos_start)) != std::string::npos) {
token = str.substr(pos_start, pos_end - pos_start);
pos_start = pos_end + delim_len;
res.push_back(token);
}

res.push_back(str.substr(pos_start));
return res;
}

std::string toLowerCase(std::string str) {
auto strCopy = std::string(str);
std::transform(strCopy.begin(), strCopy.end(), strCopy.begin(), ::tolower);
Expand Down Expand Up @@ -76,7 +62,7 @@ bool IDListLayer::init() {
auto winSize = CCDirector::sharedDirector()->getWinSize();

auto bg = CCSprite::create("GJ_gradientBG.png");
auto bgSize = bg->getTextureRect().size;
CCSize bgSize = bg->getTextureRect().size;

bg->setAnchorPoint({ 0.0f, 0.0f });
bg->setScaleX((winSize.width + 10.0f) / bgSize.width);
Expand Down Expand Up @@ -153,7 +139,6 @@ bool IDListLayer::init() {
m_refreshMenu->setPosition(CCDirector::sharedDirector()->getScreenRight() - y, y);
m_refreshMenu->setZOrder(2);
auto refreshBtn = CCMenuItemSpriteExtra::create(refreshBtnSpr, this, menu_selector(IDListLayer::onRefresh));
refreshBtn->setID("demonlist-button"_spr);
m_refreshMenu->addChild(refreshBtn);
this->addChild(m_refreshMenu);

Expand Down Expand Up @@ -371,7 +356,11 @@ void IDListLayer::onPage(CCObject*) {
}

void IDListLayer::onRandom(CCObject*) {
m_page = rand() % (paddedSize(m_fullSearchResults.size(), 10) / 10);
std::random_device os_seed;
const unsigned int seed = os_seed();
std::mt19937 generator(seed);
std::uniform_int_distribution<int> distribute(0, paddedSize(m_fullSearchResults.size(), 10) / 10 - 1);
m_page = distribute(generator);
populateList(m_query);
}

Expand Down
2 changes: 1 addition & 1 deletion src/IDListLayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class IDListLayer : public CCLayer, SetIDPopupDelegate, LevelManagerDelegate {
static void loadAREDL() {
loadAREDL([]() {});
}
static void loadAREDL(utils::MiniFunction<void()> callback);
static void loadAREDL(MiniFunction<void()> callback);

void onExit(CCObject*);
void onSearch(CCObject*);
Expand Down

0 comments on commit 5c1fb4a

Please sign in to comment.