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

NineTileBox Sprite Opacity #3430

Open
1 task
joshhammock opened this issue Jan 2, 2025 · 6 comments
Open
1 task

NineTileBox Sprite Opacity #3430

joshhammock opened this issue Jan 2, 2025 · 6 comments

Comments

@joshhammock
Copy link

Problem to solve

It looks like the NineTileBoxComponent does not have an opacity provider to be able to apply opacity effects like fadeIn fadeOut transitions, etc.

Proposal

Adding OpacityProvider to NineTileBoxComponent for use with opacity effects.

More information

Is there a known workaround that I'm missing or otherwise would this be a possible feature to add?

Other

  • Are you interested in working on a PR for this?
@spydon
Copy link
Member

spydon commented Jan 2, 2025

Should be easy to fix, we just have to add the HasPaint mixin to the component and then accept an override Paint for the class rendering it, just like for the SpriteComponent.
https://github.com/flame-engine/flame/blob/main/packages%2Fflame%2Flib%2Fsrc%2Fcomponents%2Fsprite_component.dart#L124

@joshhammock
Copy link
Author

Thanks! In the meantime I was able to mix in HasPaint to an extended NineTilesBoxComponent and extend its NineTileBox, overriding drawRect to apply the component's opacity value to drawRect's paint object.

@spydon
Copy link
Member

spydon commented Jan 2, 2025

If you want to you can put up a PR with the implementation on the real classes. :)

@joshhammock
Copy link
Author

I'm a bit of a beginner. I wouldn't trust myself not to mess something up. 😅 I'll look into giving it a try though!

@spydon
Copy link
Member

spydon commented Jan 2, 2025

If you want guidance and learn how to PR towards our repo, I can tell you how to do it. Are you on our discord?

@joshhammock
Copy link
Author

I am now. I can post when I have some availability and help would certainly be appreciated. ☺️
Discord handle is OffhandGames

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

No branches or pull requests

2 participants