Skip to content

Commit 4f4697f

Browse files
authored
ModFIles
1 parent 8958164 commit 4f4697f

8 files changed

Lines changed: 122 additions & 0 deletions

File tree

MapPackMenu/CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
cmake_minimum_required(VERSION 3.21)
2+
set(CMAKE_CXX_STANDARD 20)
3+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
4+
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR IOS)
5+
set(CMAKE_OSX_ARCHITECTURES "arm64")
6+
else()
7+
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
8+
endif()
9+
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
10+
11+
project(testmod VERSION 1.0.0)
12+
13+
# Add all source files inside src (recursively)
14+
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS src/*.cpp)
15+
16+
# Set up the mod binary
17+
add_library(${PROJECT_NAME} SHARED ${SOURCES})
18+
19+
if (NOT DEFINED ENV{GEODE_SDK})
20+
message(FATAL_ERROR "Unable to find Geode SDK! Please define GEODE_SDK environment variable to point to Geode")
21+
else()
22+
message(STATUS "Found Geode: $ENV{GEODE_SDK}")
23+
endif()
24+
25+
add_subdirectory($ENV{GEODE_SDK} ${CMAKE_CURRENT_BINARY_DIR}/geode)
26+
27+
# Set up dependencies, resources, and link Geode.
28+
setup_geode_mod(${PROJECT_NAME})

MapPackMenu/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# testmod
2+
This is where she makes a mod.
3+
4+
<img src="logo.png" width="150" alt="the mod's logo" />
5+
6+
*Update logo.png to change your mod's icon (please)*
7+
8+
## Getting started
9+
We recommend heading over to [the getting started section on our docs](https://docs.geode-sdk.org/getting-started/) for useful info on what to do next.
10+
11+
## Build instructions
12+
For more info, see [our docs](https://docs.geode-sdk.org/getting-started/create-mod#build)
13+
```sh
14+
# Assuming you have the Geode CLI set up already
15+
geode build
16+
```
17+
18+
# Resources
19+
* [Geode SDK Documentation](https://docs.geode-sdk.org/)
20+
* [Geode SDK Source Code](https://github.com/geode-sdk/geode/)
21+
* [Geode CLI](https://github.com/geode-sdk/cli)
22+
* [Bindings](https://github.com/geode-sdk/bindings/)
23+
* [Dev Tools](https://github.com/geode-sdk/DevTools)

MapPackMenu/about.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Template Mod
2+
3+
Edit about.md to change this

MapPackMenu/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# 1.0.0
2+
- Edit this file to change your mod's changelog.

MapPackMenu/logo.png

68.7 KB
Loading

MapPackMenu/mod.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"geode": "4.6.0",
3+
"gd": {
4+
"win": "2.2074",
5+
"android": "2.2074",
6+
"mac": "2.2074",
7+
"ios": "2.2074"
8+
},
9+
"id": "danielbengd.MapPackMod",
10+
"name": "MapPackInMenu",
11+
"version": "v1.0.0",
12+
"developer": "DanielBenGD",
13+
"description": "Map Pack in The Menu Mod lol"
14+
}

MapPackMenu/src/main.cpp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#include <Geode/Geode.hpp>
2+
#include <Geode/modify/MenuLayer.hpp>
3+
#include <Geode/modify/CreatorLayer.hpp>
4+
5+
using namespace geode::prelude;
6+
7+
// This mod safely adds a new Map Packs button to the top-right menu.
8+
class $modify(DanielMapPackButton, MenuLayer) {
9+
10+
// This is the function that our new button will call when clicked.
11+
void onDanielMapPackButton(CCObject* sender) {
12+
// This is the correct and safe way to open the Map Packs screen.
13+
// We create a temporary CreatorLayer just to call its onMapPacks function.
14+
// This is a standard and stable technique in Geode modding.
15+
CreatorLayer::create()->onMapPacks(sender);
16+
}
17+
18+
bool init() {
19+
if (!MenuLayer::init()) {
20+
return false;
21+
}
22+
23+
// We find the menu on the top-right of the screen.
24+
// This is the menu that holds the Settings, Profile, and other buttons.
25+
if (auto menu = this->getChildByID("right-side-menu")) {
26+
27+
// Create the sprite for our new button using the Map Packs sprite.
28+
auto btnSprite = CCSprite::createWithSpriteFrameName("GJ_mapPacksBtn_001.png");
29+
30+
// Create the button itself.
31+
auto newButton = CCMenuItemSpriteExtra::create(
32+
btnSprite,
33+
this,
34+
// We tell the button to call our new function when clicked.
35+
menu_selector(DanielMapPackButton::onDanielMapPackButton)
36+
);
37+
38+
// Set the developer ID for our new button.
39+
newButton->setID("daniel-mappack-button");
40+
41+
// Add our new button to the menu.
42+
menu->addChild(newButton);
43+
44+
// IMPORTANT: We tell the menu to update its layout.
45+
// This will automatically position our new button next to the others.
46+
menu->updateLayout();
47+
}
48+
49+
return true;
50+
}
51+
};

MapPackMenu/support.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Edit this file to change your mod's support info, or delete it if you don't need it.

0 commit comments

Comments
 (0)