Skip to content

Commit

Permalink
counter label!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
hiimjasmine00 committed Aug 8, 2024
1 parent 05c9d8f commit 9407b9e
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)

project(SearchHistory VERSION 1.0.0)
project(SearchHistory VERSION 1.0.1)

add_library(${PROJECT_NAME} SHARED
src/main.cpp
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Search History Changelog
## v1.0.1 (2024-08-07)
- Added page counter to the search history popup
- Fixed a layering issue in the mod's logo

## v1.0.0 (2024-08-07)
- Initial release
Binary file modified logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"win": "2.206",
"mac": "2.206"
},
"version": "v1.0.0",
"version": "v1.0.1",
"id": "hiimjustin000.search_history",
"name": "Search History",
"developer": "hiimjustin000",
Expand Down
Binary file modified resources/image1.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 modified resources/image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/SearchHistoryNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bool SearchHistoryNode::init(SearchHistoryObject const& object, int index, Searc
m_searchCallback = search;
m_removeCallback = remove;
m_index = index;

auto background = CCScale9Sprite::create("GJ_square01.png", { 0, 0, 80, 80 });
background->setContentSize({ 400.0f, 100.0f });
background->setPosition(200.0f, 50.0f);
Expand Down Expand Up @@ -144,7 +144,7 @@ bool SearchHistoryNode::init(SearchHistoryObject const& object, int index, Searc
demonFilterSprite->setScale(0.5f);
difficultiesNode->addChild(demonFilterSprite);
}

if (type < 1) for (auto time : object.lengths) {
auto length = std::string();
switch (time) {
Expand Down Expand Up @@ -204,7 +204,7 @@ bool SearchHistoryNode::init(SearchHistoryObject const& object, int index, Searc
std::stringstream ss;
auto time = (time_t)object.time;
ss << std::put_time(std::localtime(&time), h12 ? "%Y-%m-%d %I:%M:%S %p" : "%Y-%m-%d %H:%M:%S");

auto timeLabel = CCLabelBMFont::create(ss.str().c_str(), "chatFont.fnt");
timeLabel->setColor(white ? ccColor3B { 255, 255, 255 } : ccColor3B { 51, 51, 51 });
timeLabel->setOpacity(white ? 200 : 152);
Expand Down
8 changes: 8 additions & 0 deletions src/SearchHistoryPopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ bool SearchHistoryPopup::setup(SearchHistoryCallback callback) {
clearButton->setPosition(420.0f, 270.0f);
m_buttonMenu->addChild(clearButton);

m_countLabel = CCLabelBMFont::create("", "goldFont.fnt");
m_countLabel->setAnchorPoint({ 1.0f, 0.0f });
m_countLabel->setScale(0.5f);
m_countLabel->setPosition(435.0f, 7.0f);
m_mainLayer->addChild(m_countLabel);

m_searchInput = TextInput::create(400.0f, "Search History...");
m_searchInput->setCommonFilter(CommonFilter::Any);
m_searchInput->setTextAlign(TextInputAlign::Left);
Expand Down Expand Up @@ -97,5 +103,7 @@ void SearchHistoryPopup::page(int p) {
m_scrollLayer->m_contentLayer->updateLayout();
m_scrollLayer->scrollToTop();

m_countLabel->setString(fmt::format("{} to {} of {}", count > 0 ? p * 5 + 1 : 0, std::min((p + 1) * 5, (int)count), count).c_str());

m_page = p;
}
1 change: 1 addition & 0 deletions src/SearchHistoryPopup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class SearchHistoryPopup : public geode::Popup<SearchHistoryCallback> {
TextInput* m_searchInput;
CCMenuItemSpriteExtra* m_prevButton;
CCMenuItemSpriteExtra* m_nextButton;
CCLabelBMFont* m_countLabel;
int m_page;

bool setup(SearchHistoryCallback) override;
Expand Down

0 comments on commit 9407b9e

Please sign in to comment.