Skip to content

Add createWithButtonSprite function to geode::Button - #2180

Open
xblazegmd wants to merge 8 commits into
geode-sdk:mainfrom
xblazegmd:main
Open

Add createWithButtonSprite function to geode::Button#2180
xblazegmd wants to merge 8 commits into
geode-sdk:mainfrom
xblazegmd:main

Conversation

@xblazegmd

Copy link
Copy Markdown
Contributor

Instead of having to manually make a ButtonSprite and passing that to Button::createWithNode, why not just have a helper that can make that?

Now you can easily make one with createWithButtonSprite:

auto btn = Button::createWithButtonSprite("My Own Button!", [](auto) {
    log::info("My own button was pressed!");
});

And if you need to change anything on it (let's say, the font/background sprite) you can do that too:

auto btn = Button::createWithButtonSprite("My Own Button!", "bigFont.fnt", "GJ_button_02.png", [](auto) {
    log::info("My own button was pressed!");
});

This should work perfectly fine for 99% of cases, but I'm open to feedback on what I can change

@xblazegmd

Copy link
Copy Markdown
Contributor Author

Also idk what the absolute parameter on ButtonSprite does so if anyone could tell me so I can edit the doc comments plz

@slideglide

Copy link
Copy Markdown
Contributor

Also idk what the absolute parameter on ButtonSprite does so if anyone could tell me so I can edit the doc comments plz

image

@xblazegmd

Copy link
Copy Markdown
Contributor Author

Bruh why does only 1 specific overload of ButtonSprite::create have that description while the others don't 😭

Anyways tysm

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.

2 participants