Skip to content

Commit

Permalink
add GJCommentListLayer IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Feb 25, 2024
1 parent 00f9d7f commit 3984e9f
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/GJCommentListLayer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include <Geode/Bindings.hpp>
#include <Geode/modify/GJCommentListLayer.hpp>
#include <Geode/utils/cocos.hpp>
#include <Geode/utils/NodeIDs.hpp>

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

$register_ids(GJCommentListLayer) {
setIDs(
this,
0,
"bottom-border",
"top-border",
"left-border",
"right-border",
"list-view"
);
}

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

static GJCommentListLayer* create(BoomListView* listView, char const* title, cocos2d::ccColor4B color, float width, float height, bool blueBorder) {
/**
* GJCommentListLayer is one of the classes
* that has its init half-inlined
* so we need to hook create instead
*/
auto layer = GJCommentListLayer::create(listView, title, color, width, height, blueBorder);
if(!layer) return nullptr;

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

return layer;
}
};

0 comments on commit 3984e9f

Please sign in to comment.