Skip to content

Commit

Permalink
charactercolorpage :D (#27)
Browse files Browse the repository at this point in the history
* charactercolorpage :D

* no bindings for macos yet :(
  • Loading branch information
Weebifying authored Mar 10, 2024
1 parent ce5dc0e commit e39b215
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions src/CharacterColorPage.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#include <Geode/Geode.hpp>
#ifndef GEODE_IS_MACOS

#include <Geode/Bindings.hpp>
#include <Geode/modify/CharacterColorPage.hpp>
#include <Geode/utils/cocos.hpp>
#include <Geode/utils/NodeIDs.hpp>

using namespace geode::prelude;
using namespace geode::node_ids;

$register_ids(CharacterColorPage) {
size_t offset = 0;

auto colorsLayer = static_cast<CCLayer*>(this->getChildren()->objectAtIndex(0));
colorsLayer->setID("colors-layer");

setIDSafe(colorsLayer, offset++, "background");
if (auto menu = getChildOfType<CCMenu>(colorsLayer, 0)) {
menu->setID("buttons-menu");
setIDs(
menu,
0,
"close-button",
"ship-button",
"col1-button",
"col2-button",
"glow-button"
);

for (int i = 5; i < menu->getChildrenCount()-1; i++) {
auto child = as<CCMenuItemSpriteExtra*>(menu->getChildren()->objectAtIndex(i));
child->setID(std::to_string(child->getTag()));
}

setIDSafe(menu, menu->getChildrenCount()-1, "glow-toggler");
}

offset++;
setIDs(
colorsLayer,
offset,
"icon-background",
"cube-icon",
"ball-icon",
"ufo-icon",
"wave-icon",
"robot-icon",
"spider-icon",
"swing-icon",
"cursor-col1",
"cursor-col2",
"cursor-glow",
"glow-label"
);
}

struct CharacterColorPageIDS : Modify<CharacterColorPageIDS, CharacterColorPage> {
static void onModify(auto& self) {
if (!self.setHookPriority("CharacterColorPage::init", GEODE_ID_PRIORITY)) {
log::warn("Failed to set CharacterColorPage::init hook priority, node IDs may not work properly");
}
}

bool init() {
if (!CharacterColorPage::init()) return false;

NodeIDs::get()->provide(this);

return true;
}
};
#endif

0 comments on commit e39b215

Please sign in to comment.