Skip to content

Conversation

@BlueWitherer
Copy link
Contributor

A simple convenient function for developers to quickly add a very basic back button onto their custom UI layers. Here's an example of a pink back button applied to this template layer.
image

The function is defined as such.

    void addBackButton(
        cocos2d::CCNode* to,
        cocos2d::CCObject* target,
        cocos2d::SEL_MenuHandler selector,
        BackButtonStyle style = BackButtonStyle::Green
    );

It's as simple as pie!

geode::addBackButton(this, this, menu_selector(ExampleLayer::onGoBack)); // or any class function!
geode::addBackButton(this, this, menu_selector(ExampleLayer::onGoBack), BackButtonStyle::Pink); // make it pretty!

It can get annoying for developers having to manually create this button every time especially when they're working with multiple custom layers; the intention behind this is to simply streamline that process.

originally suggested by @DumbCaveSpider

@BlueWitherer
Copy link
Contributor Author

just learned gametoolbox has this but it just crashes when used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant