-
Notifications
You must be signed in to change notification settings - Fork 439
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
Fix FlxCamera.fill() blending #3217
Conversation
Alternatively this can be turned into a feature by passing blend to FlxCamera.fill() with default value being null (BlendMode.NORMAL) final someColor = new FlxColor(0x99ff00ff);
final someBlendMode = BlendMode.ADD;
FlxG.camera.fill(someColor.rgb, true, someColor.alphaFloat, FlxG.camera.canvas.graphics, someBlendMode); Note: just piggybanking an idea, will probably use it for personal stuff, tho let me know if it's good or meh. |
Reverted both parts like this, i don't want unrelated functional changes amended to PRs and this may technically be a "breaking change" if (_fxFlashColor.alpha == 0)
_fxFlashColor.alpha = 0xff; also cleaned up the style changes a little more, not a fan of having vars crated outside of code blocks, only to be used inside of code blocks |
Thanks! |
The reason why I added these parts was because of how drawFX() used alpha component of the effect color before this pr's changes, where if color had no alpha it would just set it to 255, so technically it wasn't a "breaking change". // Draw the "fade" special effect onto the buffer
if (_fxFadeAlpha > 0.0)
{
alphaComponent = _fxFadeColor.alpha;
if (FlxG.renderBlit)
{
fill((Std.int(((alphaComponent <= 0) ? 0xff : alphaComponent) * _fxFadeAlpha) << 24) + (_fxFadeColor & 0x00ffffff));
}
else
{
fill((_fxFadeColor & 0x00ffffff), true, ((alphaComponent <= 0) ? 0xff : alphaComponent) * _fxFadeAlpha / 255, canvas.graphics);
}
} Note: Just giving a reasoning to why such changes were made, not to imply that they were necessary, I was just following the functionality of drawFX(). |
I understand but its a separate issue and it will change how an existing tool is designed to function, rather than an unintended bug, and therefore a breaking change to anyone who has made games with the previous functionality in mind. Also changes like this need to consider broader conventions, what do other flixel tools do in the case of 0 alpha channel, how can we make tools that use colors with 0 alpha more cohesive and behave expectedly. I really don't want willy nilly changes to behavior like this without considering the broader scope |
Fixes #3203 by overriding the blend mode of target graphics in FlxCamera.fill() to null (BlendMode.NORMAL). Does not affect blitting targets since blend modes just doesn't work there.
Additionally makes drawFX more readable