Skip to content

Commit

Permalink
SEARCH HISTORY LET'S GO
Browse files Browse the repository at this point in the history
  • Loading branch information
hiimjasmine00 committed Aug 7, 2024
0 parents commit c2c5b90
Show file tree
Hide file tree
Showing 25 changed files with 866 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build Geode Mod

on:
workflow_dispatch:
push:
branches:
- "master"

jobs:
build:
strategy:
fail-fast: false
matrix:
config:
- name: Windows
os: windows-latest

- name: macOS
os: macos-latest

- name: Android32
os: ubuntu-latest
target: Android32

- name: Android64
os: ubuntu-latest
target: Android64

name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}

steps:
- uses: actions/checkout@v4

- name: Build the mod
uses: geode-sdk/build-geode-mod@main
with:
build-config: RelWithDebInfo
export-pdb: true
combine: true
target: ${{ matrix.config.target }}

package:
name: Package builds
runs-on: ubuntu-latest
needs: ['build']

steps:
- uses: geode-sdk/build-geode-mod/combine@main
id: build

- uses: actions/upload-artifact@v4
with:
name: Build Output
path: ${{ steps.build.outputs.build-output }}

release:
name: Release the mod
runs-on: ubuntu-latest
needs: ['package']

steps:
- uses: actions/checkout@v4

- uses: hiimjustin000/release-geode-mod@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Macos be like
**/.DS_Store

# Cache files for Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache

# Ignore build folders
**/build
# Ignore platform specific build folders
build-*/

# Workspace files are user-specific
*.sublime-workspace

# ILY vscode
**/.vscode
.idea/

# clangd
.cache/

# Visual Studio
.vs/

# Bruh
logo.pdn
24 changes: 24 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.21)
set(CMAKE_CXX_STANDARD 20)
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)

add_library(${PROJECT_NAME} SHARED
src/main.cpp
src/SearchHistory.cpp
src/SearchHistoryNode.cpp
src/SearchHistoryPopup.cpp
)

if (NOT DEFINED ENV{GEODE_SDK})
message(FATAL_ERROR "Unable to find Geode SDK! Please define GEODE_SDK environment variable to point to Geode")
else()
message(STATUS "Found Geode: $ENV{GEODE_SDK}")
endif()

add_subdirectory($ENV{GEODE_SDK} ${CMAKE_CURRENT_BINARY_DIR}/geode)

setup_geode_mod(${PROJECT_NAME})
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 hiimjustin000

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Search History
A mod that allows you to view your search history.

## Features
- A button in the level search menu that allows you to view your search history
- A popup that shows your search history, including a filter text box, and entries that can be used to search again

## Credits
- [Kabslantivity](https://gdbrowser.com/u/17597362) - Initial idea for the mod
- [at4pm](https://gdbrowser.com/u/27791517) - Additional ideas for the mod
- [hiimjustin000](https://gdbrowser.com/u/7466002) - Creator of the mod

## Gallery
![Search History Popup 1](./resources/image1.png)
![Search History Popup 2](./resources/image2.png)

# License
This mod is licensed under the [MIT License](./LICENSE).
15 changes: 15 additions & 0 deletions about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Search History
A mod that allows you to view your search history.

## Features
- A button in the level search menu that allows you to view your search history
- A popup that shows your search history, including a filter text box, and entries that can be used to search again

## Credits
- [Kabslantivity](user:17597362) - Initial idea for the mod
- [at4pm](user:27791517) - Additional ideas for the mod
- [hiimjustin000](user:7466002) - Creator of the mod

## Gallery
![Search History Popup 1](hiimjustin000.search_history/image1.png?scale=0.6)\
![Search History Popup 2](hiimjustin000.search_history/image2.png?scale=0.6)
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Search History Changelog
## v1.0.0 (2024-08-07)
- Initial release
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"geode": "3.4.0",
"gd": {
"android": "2.206",
"win": "2.206",
"mac": "2.206"
},
"version": "v1.0.0",
"id": "hiimjustin000.search_history",
"name": "Search History",
"developer": "hiimjustin000",
"description": "A mod that allows you to view your search history.",
"repository": "https://github.com/hiimjustin000/SearchHistory",
"dependencies": [
{
"id": "geode.node-ids",
"version": ">=v1.12.0",
"importance": "required"
}
],
"resources": {
"sprites": [
"resources/*.png"
],
"spritesheets": {
"HistorySheet": [
"resources/HistorySheet/*.png"
]
}
},
"settings": {
"12-hour-time": {
"name": "12-Hour Time",
"description": "Whether or not to use 12-hour time on the time label.",
"type": "bool",
"default": false
},
"white-time": {
"name": "White Time",
"description": "Whether or not to color the time label white.",
"type": "bool",
"default": false
}
},
"tags": [
"enhancement",
"interface",
"offline",
"utility"
]
}
Binary file added resources/HistorySheet/SH_epicCoin2_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/HistorySheet/SH_epicCoin3_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/HistorySheet/SH_epicCoin_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/HistorySheet/SH_featuredCoin_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/HistorySheet/SH_originalIcon_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/HistorySheet/SH_twoPlayerBtn_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/SH_historyBtn_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/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 added 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.
56 changes: 56 additions & 0 deletions src/SearchHistory.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include "SearchHistory.hpp"

void SearchHistory::add(GJSearchObject* search, time_t time, int type) {
auto history = Mod::get()->getSavedValue<std::vector<SearchHistoryObject>>("search-history");

auto difficultyStrings = search->m_difficulty != "-" ? string::split(search->m_difficulty, ",") : std::vector<std::string>();
auto difficulties = std::vector<int>();
for (auto const& str : difficultyStrings) {
difficulties.push_back(std::stoi(str));
}

auto lengthStrings = search->m_length != "-" ? string::split(search->m_length, ",") : std::vector<std::string>();
auto lengths = std::vector<int>();
for (auto const& str : lengthStrings) {
lengths.push_back(std::stoi(str));
}

history.insert(history.begin(), {
.time = time,
.type = type,
.query = search->m_searchQuery,
.difficulties = difficulties,
.lengths = lengths,
.uncompleted = search->m_uncompletedFilter,
.completed = search->m_completedFilter,
.featured = search->m_featuredFilter,
.original = search->m_originalFilter,
.twoPlayer = search->m_twoPlayerFilter,
.coins = search->m_coinsFilter,
.epic = search->m_epicFilter,
.legendary = search->m_legendaryFilter,
.mythic = search->m_mythicFilter,
.song = search->m_songFilter,
.customSong = search->m_customSongFilter,
.songID = search->m_songID,
.demonFilter = (int)search->m_demonFilter,
.noStar = search->m_noStarFilter,
.star = search->m_starFilter
});

Mod::get()->setSavedValue("search-history", history);
}

void SearchHistory::clear() {
Mod::get()->setSavedValue("search-history", std::vector<SearchHistoryObject>());
}

std::vector<SearchHistoryObject> SearchHistory::get() {
return Mod::get()->getSavedValue<std::vector<SearchHistoryObject>>("search-history");
}

void SearchHistory::remove(int index) {
auto history = Mod::get()->getSavedValue<std::vector<SearchHistoryObject>>("search-history");
history.erase(history.begin() + index);
Mod::get()->setSavedValue("search-history", history);
}
Loading

0 comments on commit c2c5b90

Please sign in to comment.