Skip to content

Commit

Permalink
very important qolmod integration
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Jan 5, 2025
1 parent 8b7b185 commit 3679185
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"geode": "4.1.0",
"version": "v1.2.0",
"version": "v1.2.1",
"gd": {
"win": "2.2074",
"mac": "2.2074",
Expand Down
1 change: 1 addition & 0 deletions src/CCLabelBMFontExt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ void CCLabelBMFontExt::updateLabel()

objNode->removeAllChildrenWithCleanup(true);

auto oldParts = parts;
parts.clear();

CCSize size = CCSizeMake(0, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/CCLabelBMFontExt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CCLabelBMFontExt : public CCLabelBMFont {
std::string string = "";
std::string font = "";
CCTextAlignment alignment;
ccColor3B colour;
ccColor3B colour = ccc3(255, 255, 255);
GLubyte opacity = 255;
CCNode* objNode;
std::vector<LabelPart> parts;
Expand Down
57 changes: 57 additions & 0 deletions src/Hooks/EditLabelPopup.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include <Geode/Geode.hpp>
#include <Geode/modify/CCMenu.hpp>
#include "../EmojiPickPopup.hpp"

using namespace geode::prelude;

class EditLabelPopup : public geode::Popup<> {};

class $modify (EditLabelPopupExt, CCMenu)
{
struct Fields
{
TextInput* input;
};

static CCMenu* create()
{
auto pRet = CCMenu::create();

Loader::get()->queueInMainThread([pRet]
{
if (pRet->getID() == "Format" && CCScene::get()->getChildByType<EditLabelPopup>(0))
{
if (auto menu = pRet)
{
as<EditLabelPopupExt*>(pRet)->m_fields->input = menu->getChildByType<TextInput>(0);
as<AnchorLayoutOptions*>(as<EditLabelPopupExt*>(pRet)->m_fields->input->getLayoutOptions())->setOffset(ccp(-15, 0));

auto spr = CCSprite::createWithSpriteFrameName("emoji-icon-thicker.png"_spr);
spr->setOpacity(100);

auto btn = CCMenuItemSpriteExtra::create(spr, pRet, menu_selector(EditLabelPopupExt::onPickEmojis));
btn->setID("emojis-btn"_spr);

auto menu2 = CCMenu::create();
menu2->ignoreAnchorPointForPosition(false);
menu2->setContentSize(CCPointZero);
menu2->setScale(0.65f);
menu2->addChild(btn);

menu->addChildAtPosition(menu2, Anchor::Right, ccp(-22, 0));

menu->updateLayout();
}
}
});

return pRet;
}

void onPickEmojis(CCObject* sender)
{
auto popup = EmojiPickPopup::create(m_fields->input->getInputNode(), m_fields->input);
popup->show();
popup->proxy->ignoreAnchorPointForPosition(false);
}
};
23 changes: 22 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,25 @@ using namespace geode::prelude;
#include "CCLabelBMFontExt.hpp"
#include "TextAreaExt.hpp"

/**/
namespace QOLModExt
{
class CommentEmojisOverrideLabelCreatePrivateEventPleaseDoNotUseOrIWillTouchYou : public Event
{
public:
std::function<CCLabelBMFont*()> function;

CommentEmojisOverrideLabelCreatePrivateEventPleaseDoNotUseOrIWillTouchYou(std::function<CCLabelBMFont*()> function)
{
this->function = function;
}
};
};

$execute
{
auto e = QOLModExt::CommentEmojisOverrideLabelCreatePrivateEventPleaseDoNotUseOrIWillTouchYou([]
{
return CCLabelBMFontExt::create("L", "bigFont.fnt");
});
e.post();
};

0 comments on commit 3679185

Please sign in to comment.