Badges API

Jouca

Badges API

[Image: Mod Version] [Image: Downloads] [Image: GD Version] [Image: Geode Version]

An API mod to integrate badges in a special menu & optimizing UI for ProfilePage & CommentCell

[Image: Mod Example]

This mod use NodeIDs as a dependency to make tags working well, you may use it if you want to use this API.

Using as a dependency

Add the mod to your mod.json:

{
    "dependencies": [
        {
            "id": "jouca.badgesapi",
            "version": ">=v1.5.0",
            "importance": "required"
        },
        {
            "id": "geode.node-ids",
            "version": ">=v1.23.3",
            "importance": "required"
        }
    ]
}

All the hooks on this API are in very low priority states, you should make sure that your mod doesn't go too much bellow the priorities that Badges API uses for correctly detecting your badges.

How to use this mod?

  • For ProfilePage & CommentCell, you need to make sure that your badge is in the CCMenu* with the ID username-menu. Make sure to put an ID on your badge which contains -badge inside of it.

Here's an example of how to put a non-clickable badge inside:

#include 
#include 
#include 

using namespace geode::prelude;

class $modify(ProfilePage) {
    void loadPageFromUserInfo(GJUserScore* a2) {
        ProfilePage::loadPageFromUserInfo(a2);
        auto layer = m_mainLayer;

        CCMenu* username_menu = static_cast(layer->getChildByIDRecursive("username-menu"));

        auto yourBadge = CCSprite::createWithSpriteFrameName("yourBadgeSprite.png"_spr);
        yourBadge->setID("mycustombadge-badge"_spr);
        username_menu->addChild(yourBadge);
        username_menu->updateLayout();
    }
};

class $modify(CommentCell) {
    void loadFromComment(GJComment* p0) {
        CommentCell::loadFromComment(p0);
        auto layer = m_mainLayer;

        CCMenu* username_menu = static_cast(layer->getChildByIDRecursive("username-menu"));

        auto yourBadge = CCSprite::createWithSpriteFrameName("yourBadgeSprite.png"_spr);
        yourBadge->setID("mycustombadge-badge"_spr);
        username_menu->addChild(yourBadge);
        username_menu->updateLayout();
    }
};

Clickable badges

If you want your badge to open a popup or trigger an action when clicked, use CCMenuItemExt::createSpriteExtra from the Geode SDK. This ensures the click callback works correctly both in the menu and inside the BadgesAPI show-more popup.

Do not use UIBuilder's intoMenuItem for badge buttons — it stores the callback as a child node of the button, which can be invalidated when BadgesAPI moves buttons around.

#include 
#include 
#include 

using namespace geode::prelude;

class $modify(ProfilePage) {
    void loadPageFromUserInfo(GJUserScore* a2) {
        ProfilePage::loadPageFromUserInfo(a2);
        auto layer = m_mainLayer;

        CCMenu* username_menu = static_cast(layer->getChildByIDRecursive("username-menu"));

        auto sprite = CCSprite::createWithSpriteFrameName("yourBadgeSprite.png"_spr);
        auto yourBadge = CCMenuItemExt::createSpriteExtra(sprite, [](CCMenuItemSpriteExtra*) {
            FLAlertLayer::create(nullptr, "My Badge", "Badge description here.", "OK", nullptr, 300.f)->show();
        });
        yourBadge->setID("mycustombadge-badge"_spr);
        username_menu->addChild(yourBadge);
        username_menu->updateLayout();
    }
};

class $modify(CommentCell) {
    void loadFromComment(GJComment* p0) {
        CommentCell::loadFromComment(p0);
        auto layer = m_mainLayer;

        CCMenu* username_menu = static_cast(layer->getChildByIDRecursive("username-menu"));

        auto sprite = CCSprite::createWithSpriteFrameName("yourBadgeSprite.png"_spr);
        auto yourBadge = CCMenuItemExt::createSpriteExtra(sprite, [](CCMenuItemSpriteExtra*) {
            FLAlertLayer::create(nullptr, "My Badge", "Badge description here.", "OK", nullptr, 300.f)->show();
        });
        yourBadge->setID("mycustombadge-badge"_spr);
        username_menu->addChild(yourBadge);
        username_menu->updateLayout();
    }
};

Generic node badges (geode::Button, CCMenu, custom nodes)

BadgesAPI supports any CCNode subclass as a badge — not just CCSprite and CCMenuItemSpriteExtra. This includes geode::Button and other custom widget types. When multiple badges are present, BadgesAPI automatically renders the node to a texture to use as the thumbnail on the + button and inside the badges popup.

#include 
#include 
#include 

using namespace geode::prelude;

class $modify(ProfilePage) {
    void loadPageFromUserInfo(GJUserScore* a2) {
        ProfilePage::loadPageFromUserInfo(a2);
        auto layer = m_mainLayer;

        CCMenu* username_menu = static_cast(layer->getChildByIDRecursive("username-menu"));

        auto yourBadge = geode::Button::create("Label", "GJ_button_01.png"_spr, [](auto) {
            FLAlertLayer::create(nullptr, "My Badge", "Badge description here.", "OK", nullptr, 300.f)->show();
        });
        yourBadge->setID("mycustombadge-badge"_spr);
        username_menu->addChild(yourBadge);
        username_menu->updateLayout();
    }
};

When a badge node type is not CCSprite or CCMenuItemSpriteExtra, BadgesAPI renders it to a texture to generate its preview. The original node is added directly to the menu when there is only one badge.

  • You also have the possibility (optionally) to put a priority tag on the ID to your badge to place it higher on the list than some other badges using :{priority number}.
yourBadge->setID("mycustombadge-badge:100"_spr);

If you add your badge after the Layer has loaded (example with HTTP requests), it will still be added!

Credits

  • Jouca
  • elnexreal - Logo for the mod
  • Mave - Plus button texture

Contributors

License

This project is created by Jouca under the GNU General Public License v3.0, read more by clicking on the highlighted name.

Changelog

v1.6.0 (2026-11-02)

  • Badges API ported to Geode 6.0.0 (GD 2.2091)

v1.5.0 (2026-07-02)

  • Added support for any CCNode subclass as a badge (e.g. geode::Button, CCMenu, custom nodes)
  • Fixed badges using node types other than CCSprite or CCMenuItemSpriteExtra being ignored
  • Fixed badge preview in the + popup for non-standard node types using CCRenderTexture

v1.4.2 (2026-04-22)

  • Fixed listener assignment for CCMenuItemSpriteExtra
  • Updated documentation & also for clickable badges

v1.4.1 (2026-02-23)

  • Fixed positionning of username-menu when adding multiple badges

v1.4.0 (2026-02-22)

  • Badges API ported to Geode 5.0.0 (GD 2.2081)
  • Fixed bugs & issues to the codebase (thanks RayDeeUx & Fire for the contribution!)

v1.3.1 (2025-11-22)

  • Fixed issues related to touch priority in badge menu

v1.3.0 (2025-09-18)

  • Added priority tag for badges to place them more higher on the list than some others badges

v1.2.3 (2025-04-16)

  • Fixed moderator badge appearing multiple times after refreshing profile

v1.2.2 (2025-04-02)

  • Badges API ported for Geode iOS

v1.2.1 (2025-02-25)

  • Fixed data from badges not sent on badges menu

v1.2.0 (2024-11-21)

  • Badges API ported to Geode 4.0.1 (GD 2.2074)
  • Added tags for the mod

v1.1.3 (2024-10-26)

  • Fixed Node ID and tag in comments (thanks hiimjustin000 for the contribution!)

v1.1.2 (2024-10-02)

  • Fixed some bugs that was causing crashes for some mods

v1.1.1 (2024-09-16)

  • Fixed badge rescaling indefinitely when clicking everytime on the plus for comments

v1.1.0 (2024-09-15)

  • Added handler for badges in comments

v1.0.7 (2024-08-20)

  • Changed badge plus with a better plus sprite inside the current badge to still show the first badge of the user

v1.0.6 (2024-07-13)

  • Fixed badges duplication after reloading profile
  • Changed mod picture description

v1.0.5 (2024-07-10)

  • Fixed badges not handled correctly when added at the same time

v1.0.4 (2024-07-09)

  • Added plus custom badge (thanks Mave!)
  • Fixed real moderators having issues when their badge is loaded on profile twice after refresh

v1.0.3 (2024-06-23)

  • Added compatibility when you add your badge late

v1.0.2 (2024-06-23)

  • Fixed crashing when refreshing profile

v1.0.1 (2024-06-22)

  • Added badge title sprite on Badges menu
  • Edited README to make it more clear for developers
  • Edited screen preview

v1.0.0 (2024-06-22)

  • Badges API public release

Original Site made by HJfod. Geode 2 parody-ish by MeFinity.

Geode-SDK is the property of the Geode Team.


This website (Geode 2, Codename Malachite) is not affiliated with the Geode Team in any way shape or form.