Here is a list of all the utilities that Geode provides.
// Get the address of a non-virtual function
auto address1 = addresser::getNonVirtual(&MenuLayer::onMoreGames);
// Get the address of a virtual function
auto address2 = addresser::getVirtual(&MenuLayer::init);
float f = 3.14f;
// Performs a union cast, UB!
auto p1 = cast::union_cast<int>(f);
// Performs a type punning cast, UB!
auto p2 = cast::reference_cast<int>(f);
// Performs a dynamic cast void* with a static cast
auto p3 = cast::base_cast<CCNode*>(obj);
// Performs a exact type match cast
auto p4 = cast::exact_cast<CCNode*>(obj);
// Performs a dynamic cast that works with GD classes
auto p5 = cast::typeinfo_cast<CCNode*>(obj);
// readJson and readBinary also exist
auto data1 = GEODE_UNWRAP(file::readString("file.txt"));
// Reading json into a struct
auto data2 = GEODE_UNWRAP(file::readFromJson<MyStruct>("serialized.json"));
// writeBinary also exists
file::writeString("file.txt", "Hello, World!");
// Writing a struct to json
file::writeToJson("serialized.json", MyStruct());
// createDirectoryAll also exists
file::createDirectory("dir");
auto files = GEODE_UNWRAP(file::readDirectory("dir"));
Zip
and Unzip
classes exist
file::openFolder("dir");
// File picking, check the enum FilePickMode and class FilePickOptions
auto task1 = file::pick(mode, options);
auto task2 = file::pickMany(options);
// Combined with FileWatchEvent and FileWatchFilter
GEODE_UNWRAP(file::watchFile("file.txt"));
auto written = clipboard::write("Hello, World!");
auto read = clipboard::read();
game::exit();
game::restart();
auto name = thread::getName();
thread::setName("MyThread");
auto status = permission::getPermissionStatus(Permission::ReadAllFiles);
permission::requestPermission(Permission::ReadAllFiles);
utils::terminate("Error message");
utils::unreachable();
TODO: this ones long just check Geode/utils/web.hpp
// Hooking a method
auto hook1 = GEODE_UNWRAP(ObjcHook::create("EAGLView", "initWithFrame:", &MyFunc));
auto hook2 = GEODE_UNWRAP(ObjcHook::create("EAGLView", "initWithFrame:", &MyFunc, &emptyFunc));
// This is where geode is located!
auto geodeDir = dirs::getGeodeDir();
// This is where geodes resources are stored!
auto geodeResourcesDir = dirs::getGeodeResourcesDir();
// This is where geodes saves its files!
auto geodeSaveDir = dirs::getGeodeSaveDir();
// This is where mod's save files are!
auto modSaveDir = dirs::getModsSaveDir();
// This is where GD saves its files!
auto saveDir = dirs::getSaveDir();
// Other directories also exist
Visit the tasks page for more information.
A shared_ptr and weak_ptr like class for GD objects.
Ref<CCNode> m_node;
A class that listens for events. It is automatically removed when the node is removed.
A class that wraps a GD object.
// children
getChild
getChildByTagRecursive
findFirstChildRecursive
getChildBySpriteFrameName
getChildBySpriteName
// safe check
nodeOrDefault
isSpriteFrameName
isSpriteName
nodeIsVisible
// sizes
calculateNodeCoverage
calculateChildCoverage
limitNodeSize
limitNodeWidth
limitNodeHeight
// scene
switchToScene
// textures
reloadTextures
// file
fileExistsInSearchPaths
// color
ccDrawColor4B
invert4B
invert3B
lighten3B
darken3B
to3B
to4B
to4F
cc3bFromHexString
cc4bFromHexString
// containers
vectorToCCArray
vectorToCCArray
ccArrayToVector
mapToCCDict
mapToCCDict
getMousePos
A std::back_inserter
like class for CCArrays.
A wrapper for CCArray that provides iteration and indexing.
A wrapper for CCDictionary that provides iteration and indexing.
A wrapper for CCMenuItem that provides more useful constructors like taking a lambda.
A wrapper for CallFunc that takes a lambda.
// recursively sets the touch priority of the children based on itself
handleTouchPriority(this)
VersionInfo
, ComparableVersionInfo
and semverCompare
Timer
and LogPerformance
wideToUtf8
utf8ToWide
toLower
toUpper
replace
split
join
contains
containsAny
containsAll
count
trimLeft
trimRight
trim
normalize
startsWith
endsWith
caseInsensitiveCompare
GD headers use them, its mostly transparent to you.
find
indexOf
move
join
push
concat
remove
filter
reduce
map
min
max
reverse
setIDSafe
setIDs
switchToMenu
switchChildToMenu
switchChildrenToMenu
detachAndCreateNode
getSizeSafe
contains
select
selectAll
values
keys
remap
auto json = checkJson(value, "[root]");
// check the class JsonExpectedValue
toBytes
getOr
hash
intToHex
numToString
numToAbbreviatedString
numFromString
timePointAsString`
No idea how to use this one.