Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing Highlighted image is awkward #148

Open
Crushy opened this issue Sep 11, 2013 · 1 comment
Open

Changing Highlighted image is awkward #148

Crushy opened this issue Sep 11, 2013 · 1 comment

Comments

@Crushy
Copy link
Contributor

Crushy commented Sep 11, 2013

I'm trying to make a multi-purpose button that will display an image of the currently selected level. This means I need to change it's "regular" sprite and the highlight sprite. My code currently looks like this:

LevelPreview.setSpriteImage("IconLevel_" + lvlIndex+ ".png");
LevelPreview.highlightedUVframe = this.levelSelectToolkit.uvRectForFilename("IconLevel_" + lvlIndex+ ".png");

Maybe I'm nitpicking but this doesn't look too healthy. We could argue that UIButtons weren't created for this sort of behaviour but that makes the setSpriteImage method seem a bit useless by itself.

I could submit a patch for UIButtons but I'm sure the problem would manifest itself for other components that use more than one sprite.

@Crushy
Copy link
Contributor Author

Crushy commented Sep 11, 2013

I also want to add that even that code has issues:
When the mouse is released outside the button the highlight button set on creation is left behind instead of the new one.

@Crushy Crushy closed this as completed Sep 12, 2013
@Crushy Crushy reopened this Sep 12, 2013
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

No branches or pull requests

1 participant