Code Monkey home page Code Monkey logo

badgesapi's Introduction

Badges API

An API mod for a better display for badges.

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.0.6",
            "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, 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 your badge inside:

#include <Geode/Geode.hpp>
#include <Geode/modify/ProfilePage.hpp>

using namespace geode::prelude;

class $modify(ProfilePage) {
    void loadPageFromUserInfo(GJUserScore* a2) {
        ProfilePage::loadPageFromUserInfo(a2);
        auto layer = m_mainLayer;
        
        CCMenu* username_menu = typeinfo_cast<CCMenu*>(layer->getChildByIDRecursive("username-menu"));
        // your code for create your badge
        yourBadge->setID("mycustombadge-badge")
        username_menu->addChild(yourBadge);
    }
};

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

License

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

badgesapi's People

Contributors

jouca avatar

Stargazers

Axel avatar Flainn avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.