diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..beb93f6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,55 @@ +name: Build Geode Mod + +on: + workflow_dispatch: + push: + branches: + - '**' + +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: + cli: v3.0.0-beta.1 + sdk: nightly + 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@v3 + with: + name: Build Output + path: ${{ steps.build.outputs.build-output }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..beb171c --- /dev/null +++ b/.gitignore @@ -0,0 +1,58 @@ +# 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/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..4d02c4e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.21) +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) + +project(CopyLevelInfo VERSION 1.0.0) + +add_library(${PROJECT_NAME} SHARED + src/main.cpp + # Add any extra C++ source files here +) + +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}) diff --git a/README.md b/README.md new file mode 100644 index 0000000..2effd51 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# A message from the dev of Copy Level Info + +This mod is not meant to be publicly expanded on and only exists to purely make my life easier recording videos. + +## Code quality +It's probably bad but I know jack shit about CPP, its amazing this even compiles let alone function as expected at all. diff --git a/about.md b/about.md new file mode 100644 index 0000000..dc5ff4f --- /dev/null +++ b/about.md @@ -0,0 +1,22 @@ +# Copy Level Info + +This mod allows the user to copy some basic information about a level to their clipboard at the click of a button. + +## What is copied to the clipboard +The following information is copied to the clipboard with some extra stuff inserted here and there to keep things neat and tidy. + +- Level Author +- Level Name +- Level ID +- Song Link + +## Formatting +All the information listed above is formatted as follows: + +{Level Author} - {Level Name} (Geometry Dash) +\============================================= +Level ID: {Level ID} +Song: {Song Link} + +Note: The divider constructed of the equals symbol (=) is dynamic, meaning that it is always the same length in terms of characters as the first line of text. +If line one was 23 characters long, the divider will be a string of 23 equal symbols (=), if line one was 56 characters long, the divider would be 56 characters long. diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..ccff614 --- /dev/null +++ b/changelog.md @@ -0,0 +1,5 @@ +# v1.0.0 + * Initial release of the project and hopefully the last, CPP is really not a fun language. + +# v1.1.0 + * Updated to GD v2.206 and Geode V3 \ No newline at end of file diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..a69fba1 Binary files /dev/null and b/logo.png differ diff --git a/mod.json b/mod.json new file mode 100644 index 0000000..b5626f1 --- /dev/null +++ b/mod.json @@ -0,0 +1,19 @@ +{ + "geode": "3.0.0-alpha.2", + "gd": "2.206", + "version": "v1.1.0", + "id": "neonyaa.copy_level_info", + "name": "Copy Level Info", + "developer": "NeoNyaa", + "description": "A simple mod which allows the user to copy the level name and ID to the clipboard.", + "tags": [ + "enhancement", + "interface", + "utility" + ], + "resources": { + "sprites": [ + "resources/Copy.png" + ] + } +} \ No newline at end of file diff --git a/resources/Copy.png b/resources/Copy.png new file mode 100644 index 0000000..27b003e Binary files /dev/null and b/resources/Copy.png differ diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..6e836e4 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,33 @@ +#include +#include + +using namespace geode::prelude; + +class $modify(InfoLayer) { + void onCopyLevelID(CCObject*) { + /* + Get the name of the author and the level name then string them together + seperating them with " - " and append it with "(Geometry Dash)" lastly, + store the result in a variable called "ytVideoTitle" for later use + */ + std::string ytVideoTitle = fmt::format("{} - {} (Geometry Dash)", this->m_level->m_creatorName, this->m_level->m_levelName); + + /* + Get the length of the "ytVideoTitle" variable and use the returned value to create + a string of "=" symbols which is the same length as the "ytVideoTitle" variable + */ + std::string ytVideoDivider = std::string(ytVideoTitle.length(), '='); + + // Get the ID of the level and store it in a variabled called "ytVideoDescLevelID" for later use + std::string ytVideoDescLevelID = std::to_string(this->m_level->m_levelID.value()); + + // Get the ID of the level song and store it in a variabled called "ytVideoDescSongLink" for later use + std::string ytVideoDescSongLink = std::to_string(this->m_level->m_songID); + + // Prepare and copy the formatted data above to the clipboard for easy pasting wherever the user wants + clipboard::write(fmt::format("{}\n{}\nLevel ID: {}\nSong: https://www.newgrounds.com/audio/listen/{}\n", ytVideoTitle, ytVideoDivider, ytVideoDescLevelID, ytVideoDescSongLink)); + + // Notify the player to let them know that all the level information has been copied to their clipboard + Notification::create(("Level info copied to clipboard!"), CCSprite::create("Copy.png"_spr), 3)->show(); + } +};