Skip to content

Commit

Permalink
add unread marker for messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Nov 26, 2024
1 parent 27338ad commit 9af048c
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/hooks/GJMessageCell.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <Geode/Geode.hpp>
#include <Geode/modify/GJMessageCell.hpp>

#include "../utils.hpp"

using namespace geode::prelude;

class BI_DLL $modify(BIGJMessageCell, GJMessageCell) {
void loadFromMessage(GJUserMessage* b) {
GJMessageCell::loadFromMessage(b);

if(m_message->m_read || !m_message->m_outgoing) return;

if(auto title = m_mainLayer->getChildByID("title-label")) {
auto marker = cocos2d::CCLabelBMFont::create("!", "bigFont.fnt");
marker->setScale(0.5f);
marker->setAnchorPoint({0.0f, 0.5f});
marker->setPosition(title->getPosition() + CCPoint(title->getScaledContentWidth() + 5.0f, 0.0f));
marker->setColor({0, 255, 0});
marker->setID("unread-mark"); // no _spr because we're emulating a vanilla node
m_mainLayer->addChild(marker);
}
}
};

0 comments on commit 9af048c

Please sign in to comment.