Skip to content

Commit

Permalink
Support for blend modes with drawQuads, closes #2196 (#2199)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeCreates authored and Gama11 committed Dec 7, 2018
1 parent e63bea8 commit cf499d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions flixel/FlxCamera.hx
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ class FlxCamera extends FlxBasic
&& _headTiles.colored == colored
&& _headTiles.hasColorOffsets == hasColorOffsets
&& _headTiles.blending == blendInt
&& _headTiles.blend == blend
&& _headTiles.antialiasing == smooth
&& _headTiles.shader == shader)
{
Expand All @@ -493,6 +494,7 @@ class FlxCamera extends FlxBasic
itemToReturn.colored = colored;
itemToReturn.hasColorOffsets = hasColorOffsets;
itemToReturn.blending = blendInt;
itemToReturn.blend = blend;
itemToReturn.shader = shader;

itemToReturn.nextTyped = _headTiles;
Expand Down
1 change: 1 addition & 0 deletions flixel/graphics/tile/FlxDrawBaseItem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class FlxDrawBaseItem<T>
public var colored:Bool = false;
public var hasColorOffsets:Bool = false;
public var blending:Int = 0;
public var blend:BlendMode;

public var type:FlxDrawItemType;

Expand Down
5 changes: 4 additions & 1 deletion flixel/graphics/tile/FlxDrawQuadsItem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ class FlxDrawQuadsItem extends FlxDrawBaseItem<FlxDrawQuadsItem>

setParameterValue(shader.hasTransform, true);
setParameterValue(shader.hasColorTransform, colored || hasColorOffsets);


#if (openfl > "8.7.0")
camera.canvas.graphics.overrideBlendMode(blend);
#end
camera.canvas.graphics.beginShaderFill(shader);
camera.canvas.graphics.drawQuads(rects, null, transforms);
super.render(camera);
Expand Down

0 comments on commit cf499d6

Please sign in to comment.