-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
278 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: | ||
bindings: geode-sdk/bindings | ||
bindings-ref: main | ||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# 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 | ||
|
||
# Local History for Visual Studio Code | ||
.history/ | ||
|
||
# clangd | ||
.cache/ | ||
|
||
# Visual Studio | ||
.vs/ | ||
|
||
# CLion | ||
.idea/ | ||
/cmake-build-*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
cmake_minimum_required(VERSION 3.21) | ||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64") | ||
set(CMAKE_CXX_VISIBILITY_PRESET hidden) | ||
set(GEODE_TARGET_PLATFORM "Win64") | ||
|
||
project(test VERSION 1.0.0) | ||
|
||
# Set up the mod binary | ||
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) | ||
|
||
# Set up dependencies, resources, and link Geode. | ||
setup_geode_mod(${PROJECT_NAME}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Template Mod | ||
|
||
Edit about.md to change this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
# remember to actually set these.. | ||
export SPLAT_DIR=~/.local/share/Geode/cross-tools/splat | ||
export TOOLCHAIN=~/.local/share/Geode/cross-tools/clang-msvc-sdk/clang-cl-msvc.cmake | ||
export HOST_ARCH=x86_64 | ||
|
||
# you can also use `-G Ninja` here | ||
cmake \ | ||
-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \ | ||
-B build | ||
|
||
cmake --build build --config Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# 1.0.0 | ||
- Edit this file to change your mod's changelog. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"geode": "3.7.0", | ||
"gd": { | ||
"win": "2.206", | ||
"android": "2.206", | ||
"mac": "2.206", | ||
"ios": "2.206" | ||
}, | ||
"id": "cubesicle.test", | ||
"name": "test", | ||
"version": "v1.0.0", | ||
"developer": "Cubesicle", | ||
"description": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/** | ||
* Include the Geode headers. | ||
*/ | ||
#include <Geode/Geode.hpp> | ||
|
||
/** | ||
* Brings cocos2d and all Geode namespaces to the current scope. | ||
*/ | ||
using namespace geode::prelude; | ||
|
||
/** | ||
* `$modify` lets you extend and modify GD's classes. | ||
* To hook a function in Geode, simply $modify the class | ||
* and write a new function definition with the signature of | ||
* the function you want to hook. | ||
* | ||
* Here we use the overloaded `$modify` macro to set our own class name, | ||
* so that we can use it for button callbacks. | ||
* | ||
* Notice the header being included, you *must* include the header for | ||
* the class you are modifying, or you will get a compile error. | ||
* | ||
* Another way you could do this is like this: | ||
* | ||
* struct MyMenuLayer : Modify<MyMenuLayer, MenuLayer> {}; | ||
*/ | ||
#include <Geode/modify/MenuLayer.hpp> | ||
class $modify(MyMenuLayer, MenuLayer) { | ||
/** | ||
* Typically classes in GD are initialized using the `init` function, (though not always!), | ||
* so here we use it to add our own button to the bottom menu. | ||
* | ||
* Note that for all hooks, your signature has to *match exactly*, | ||
* `void init()` would not place a hook! | ||
*/ | ||
bool init() { | ||
/** | ||
* We call the original init function so that the | ||
* original class is properly initialized. | ||
*/ | ||
if (!MenuLayer::init()) { | ||
return false; | ||
} | ||
|
||
/** | ||
* You can use methods from the `geode::log` namespace to log messages to the console, | ||
* being useful for debugging and such. See this page for more info about logging: | ||
* https://docs.geode-sdk.org/tutorials/logging | ||
*/ | ||
log::debug("Hello from my MenuLayer::init hook! This layer has {} children.", this->getChildrenCount()); | ||
|
||
/** | ||
* See this page for more info about buttons | ||
* https://docs.geode-sdk.org/tutorials/buttons | ||
*/ | ||
auto myButton = CCMenuItemSpriteExtra::create( | ||
CCSprite::createWithSpriteFrameName("GJ_likeBtn_001.png"), | ||
this, | ||
/** | ||
* Here we use the name we set earlier for our modify class. | ||
*/ | ||
menu_selector(MyMenuLayer::onMyButton) | ||
); | ||
|
||
/** | ||
* Here we access the `bottom-menu` node by its ID, and add our button to it. | ||
* Node IDs are a Geode feature, see this page for more info about it: | ||
* https://docs.geode-sdk.org/tutorials/nodetree | ||
*/ | ||
auto menu = this->getChildByID("bottom-menu"); | ||
menu->addChild(myButton); | ||
|
||
/** | ||
* The `_spr` string literal operator just prefixes the string with | ||
* your mod id followed by a slash. This is good practice for setting your own node ids. | ||
*/ | ||
myButton->setID("my-button"_spr); | ||
|
||
/** | ||
* We update the layout of the menu to ensure that our button is properly placed. | ||
* This is yet another Geode feature, see this page for more info about it: | ||
* https://docs.geode-sdk.org/tutorials/layouts | ||
*/ | ||
menu->updateLayout(); | ||
|
||
/** | ||
* We return `true` to indicate that the class was properly initialized. | ||
*/ | ||
return true; | ||
} | ||
|
||
/** | ||
* This is the callback function for the button we created earlier. | ||
* The signature for button callbacks must always be the same, | ||
* return type `void` and taking a `CCObject*`. | ||
*/ | ||
void onMyButton(CCObject*) { | ||
FLAlertLayer::create("Geode", "Hello from my custom mod!", "OK")->show(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Edit this file to change your mod's support info, or delete it if you don't need it. |