Skip to content

Commit a0d7539

Browse files
authored
Merge branch 'HaxeFlixel:dev' into bugfix/render-triangle-fix
2 parents 4ad77fc + ddde59e commit a0d7539

File tree

16 files changed

+325
-202
lines changed

16 files changed

+325
-202
lines changed

CHANGELOG.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
1-
# 6.1.0 (Apr 28, 2025)
1+
### 6.1.1 (Oct 7, 2025)
2+
3+
#### Changes and improvements:
4+
- `FlxSignal`: Remove antiquated Hashlink workaround ([#3458](https://github.com/HaxeFlixel/flixel/pull/3458))
5+
- `FlxCollision`: Make result optional in `calcRectExit` ([#3448](https://github.com/HaxeFlixel/flixel/pull/3448))
6+
- `FlxCamera`: Honor alpha in `flash()` ([#3455](https://github.com/HaxeFlixel/flixel/pull/3455))
7+
- `FlxGame`: Update inputs before dispatching `FlxG.signals.preUpdate` ([#3442](https://github.com/HaxeFlixel/flixel/pull/3442))
8+
- `FlxTouchManager`: add null-safety ([#3440](https://github.com/HaxeFlixel/flixel/pull/3440))
9+
- `FlxCamera`: Improve error message when drawing a destroyed `FlxGraphic` ([#3417](https://github.com/HaxeFlixel/flixel/pull/3417))
10+
- `FlxCamera`: Remove references to unused `blending` variable ([#3467](https://github.com/HaxeFlixel/flixel/pull/3467))
11+
- `FlxText`: Improve pixel font support ([#3453](https://github.com/HaxeFlixel/flixel/pull/3453))
12+
- `FlxDrawQuadsItem`: Call `endFill()` after drawing ([#3462](https://github.com/HaxeFlixel/flixel/pull/3462))
13+
- `FlxFrame`: Update `uv` in `clip` method ([#3476](https://github.com/HaxeFlixel/flixel/pull/3476))
14+
- `FlxSignal`: Allow `destroy` during `dispatch` ([#3436](https://github.com/HaxeFlixel/flixel/pull/3436))
15+
- `FlxG.gamepads`: Extend PS4 mapping to work with PS5 ([#3380](https://github.com/HaxeFlixel/flixel/pull/3380))
16+
17+
#### Bugfixes:
18+
- `FlxCamera`: Honor `filter` changes when `active = false` ([#3481](https://github.com/HaxeFlixel/flixel/pull/3481))
19+
- `FlxUVRect`: Fix mixup of `right` and `top` fields ([#3475](https://github.com/HaxeFlixel/flixel/pull/3475))
20+
- `FlxCamera`: Fix `FlxStrip` disapearing on zoomed out cameras ([#3484](https://github.com/HaxeFlixel/flixel/pull/3484))
21+
- `FlxFrame`: Fix rotated frames not rendering on Hashlink ([#3454](https://github.com/HaxeFlixel/flixel/pull/3454))
22+
- `FlxSound`: Prevent paused sounds resuming on focus ([#3316](https://github.com/HaxeFlixel/flixel/pull/3316))
23+
- `FlxTilemap`: Fix debug draw when zoomed ([#3504](https://github.com/HaxeFlixel/flixel/pull/3504))
24+
25+
## 6.1.0 (Apr 28, 2025)
226

327
#### Changes and improvements:
428
- Various improvements to debug tools ([#3328](https://github.com/HaxeFlixel/flixel/pull/3328)) ([#3374](https://github.com/HaxeFlixel/flixel/pull/3374)) ([#3375](https://github.com/HaxeFlixel/flixel/pull/3375))

flixel/FlxCamera.hx

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -579,14 +579,12 @@ class FlxCamera extends FlxBasic
579579
return startTrianglesBatch(graphic, smooth, colored, blend);
580580
#else
581581
var itemToReturn = null;
582-
var blendInt:Int = FlxDrawBaseItem.blendToInt(blend);
583582

584583
if (_currentDrawItem != null
585584
&& _currentDrawItem.type == FlxDrawItemType.TILES
586585
&& _headTiles.graphics == graphic
587586
&& _headTiles.colored == colored
588587
&& _headTiles.hasColorOffsets == hasColorOffsets
589-
&& _headTiles.blending == blendInt
590588
&& _headTiles.blend == blend
591589
&& _headTiles.antialiasing == smooth
592590
&& _headTiles.shader == shader)
@@ -614,7 +612,6 @@ class FlxCamera extends FlxBasic
614612
itemToReturn.antialiasing = smooth;
615613
itemToReturn.colored = colored;
616614
itemToReturn.hasColorOffsets = hasColorOffsets;
617-
itemToReturn.blending = blendInt;
618615
itemToReturn.blend = blend;
619616
itemToReturn.shader = shader;
620617

@@ -640,19 +637,14 @@ class FlxCamera extends FlxBasic
640637
@:noCompletion
641638
public function startTrianglesBatch(graphic:FlxGraphic, smoothing:Bool = false, isColored:Bool = false, ?blend:BlendMode, ?hasColorOffsets:Bool, ?shader:FlxShader):FlxDrawTrianglesItem
642639
{
643-
var blendInt:Int = FlxDrawBaseItem.blendToInt(blend);
644-
645640
if (_currentDrawItem != null
646641
&& _currentDrawItem.type == FlxDrawItemType.TRIANGLES
647642
&& _headTriangles.graphics == graphic
648643
&& _headTriangles.antialiasing == smoothing
649644
&& _headTriangles.colored == isColored
650-
&& _headTriangles.blending == blendInt
651645
&& _headTriangles.blend == blend
652-
#if !flash
653646
&& _headTriangles.hasColorOffsets == hasColorOffsets
654647
&& _headTriangles.shader == shader
655-
#end
656648
)
657649
{
658650
return _headTriangles;
@@ -665,7 +657,6 @@ class FlxCamera extends FlxBasic
665657
public function getNewDrawTrianglesItem(graphic:FlxGraphic, smoothing:Bool = false, isColored:Bool = false, ?blend:BlendMode, ?hasColorOffsets:Bool, ?shader:FlxShader):FlxDrawTrianglesItem
666658
{
667659
var itemToReturn:FlxDrawTrianglesItem = null;
668-
var blendInt:Int = FlxDrawBaseItem.blendToInt(blend);
669660

670661
if (_storageTrianglesHead != null)
671662
{
@@ -682,12 +673,9 @@ class FlxCamera extends FlxBasic
682673
itemToReturn.graphics = graphic;
683674
itemToReturn.antialiasing = smoothing;
684675
itemToReturn.colored = isColored;
685-
itemToReturn.blending = blendInt;
686676
itemToReturn.blend = blend;
687-
#if !flash
688677
itemToReturn.hasColorOffsets = hasColorOffsets;
689678
itemToReturn.shader = shader;
690-
#end
691679

692680
itemToReturn.nextTyped = _headTriangles;
693681
_headTriangles = itemToReturn;
@@ -743,6 +731,8 @@ class FlxCamera extends FlxBasic
743731
@:allow(flixel.system.frontEnds.CameraFrontEnd)
744732
function render():Void
745733
{
734+
flashSprite.filters = filtersEnabled ? filters : null;
735+
746736
var currItem:FlxDrawBaseItem<Dynamic> = _headOfDrawStack;
747737
while (currItem != null)
748738
{
@@ -830,13 +820,13 @@ class FlxCamera extends FlxBasic
830820
public function drawTriangles(graphic:FlxGraphic, vertices:DrawData<Float>, indices:DrawData<Int>, uvtData:DrawData<Float>, ?colors:DrawData<Int>,
831821
?position:FlxPoint, ?blend:BlendMode, repeat:Bool = false, smoothing:Bool = false, ?transform:ColorTransform, ?shader:FlxShader):Void
832822
{
823+
final cameraBounds = _bounds.set(viewMarginLeft, viewMarginTop, viewWidth, viewHeight);
824+
833825
if (FlxG.renderBlit)
834826
{
835827
if (position == null)
836828
position = renderPoint.set();
837829

838-
_bounds.set(0, 0, width, height);
839-
840830
var verticesLength:Int = vertices.length;
841831
var currentVertexPosition:Int = 0;
842832

@@ -867,7 +857,7 @@ class FlxCamera extends FlxBasic
867857

868858
position.putWeak();
869859

870-
if (!_bounds.overlaps(bounds))
860+
if (!cameraBounds.overlaps(bounds))
871861
{
872862
drawVertices.splice(drawVertices.length - verticesLength, verticesLength);
873863
}
@@ -887,7 +877,8 @@ class FlxCamera extends FlxBasic
887877
_helperMatrix.translate(-viewMarginLeft, -viewMarginTop);
888878
}
889879

890-
buffer.draw(trianglesSprite, _helperMatrix);
880+
buffer.draw(trianglesSprite, _helperMatrix, transform);
881+
891882
#if FLX_DEBUG
892883
if (FlxG.debugger.drawDebug)
893884
{
@@ -905,18 +896,11 @@ class FlxCamera extends FlxBasic
905896
}
906897
else
907898
{
908-
_bounds.set(0, 0, width, height);
909-
var isColored:Bool = (colors != null && colors.length != 0);
899+
final isColored = (colors != null && colors.length != 0) || (transform != null && transform.hasRGBMultipliers());
900+
final hasColorOffsets = (transform != null && transform.hasRGBAOffsets());
910901

911-
#if !flash
912-
var hasColorOffsets:Bool = (transform != null && transform.hasRGBAOffsets());
913-
isColored = isColored || (transform != null && transform.hasRGBMultipliers());
914-
var drawItem:FlxDrawTrianglesItem = startTrianglesBatch(graphic, smoothing, isColored, blend, hasColorOffsets, shader);
915-
drawItem.addTriangles(vertices, indices, uvtData, colors, position, _bounds, transform);
916-
#else
917-
var drawItem:FlxDrawTrianglesItem = startTrianglesBatch(graphic, smoothing, isColored, blend);
918-
drawItem.addTriangles(vertices, indices, uvtData, colors, position, _bounds);
919-
#end
902+
final drawItem = startTrianglesBatch(graphic, smoothing, isColored, blend, hasColorOffsets, shader);
903+
drawItem.addTriangles(vertices, indices, uvtData, colors, position, cameraBounds, transform);
920904
}
921905
}
922906

@@ -1106,7 +1090,7 @@ class FlxCamera extends FlxBasic
11061090
_helperPoint = null;
11071091
}
11081092

1109-
_bounds = null;
1093+
_bounds = FlxDestroyUtil.put(_bounds);
11101094
scroll = FlxDestroyUtil.put(scroll);
11111095
targetOffset = FlxDestroyUtil.put(targetOffset);
11121096
deadzone = FlxDestroyUtil.put(deadzone);
@@ -1139,8 +1123,6 @@ class FlxCamera extends FlxBasic
11391123
updateFlash(elapsed);
11401124
updateFade(elapsed);
11411125

1142-
flashSprite.filters = filtersEnabled ? filters : null;
1143-
11441126
updateFlashSpritePosition();
11451127
updateShake(elapsed);
11461128
}
@@ -1676,9 +1658,6 @@ class FlxCamera extends FlxBasic
16761658
}
16771659
else
16781660
{
1679-
if (FxAlpha == 0)
1680-
return;
1681-
16821661
final targetGraphics = (graphics == null) ? canvas.graphics : graphics;
16831662

16841663
targetGraphics.overrideBlendMode(null);

flixel/FlxG.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class FlxG
100100
* The HaxeFlixel version, in semantic versioning syntax. Use `Std.string()`
101101
* on it to get a `String` formatted like this: `"HaxeFlixel MAJOR.MINOR.PATCH-COMMIT_SHA"`.
102102
*/
103-
public static var VERSION(default, null):FlxVersion = new FlxVersion(6, 1, 0);
103+
public static final VERSION = new FlxVersion(6, 1, 1);
104104

105105
/**
106106
* Internal tracker for game object.

flixel/FlxObject.hx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,8 @@ class FlxObject extends FlxBasic
159159
*/
160160
public static function separate(object1:FlxObject, object2:FlxObject):Bool
161161
{
162-
var tmp1 = object1.last.copyTo();
163-
var tmp2 = object2.last.copyTo();
164162
final separatedX = separateX(object1, object2);
165-
object1.last.x = object1.x;
166-
object2.last.x = object2.x;
167163
final separatedY = separateY(object1, object2);
168-
object1.last.copyFrom(tmp1);
169-
object2.last.copyFrom(tmp2);
170-
tmp1.put();
171-
tmp2.put();
172164
return separatedX || separatedY;
173165

174166
/*
@@ -1254,10 +1246,25 @@ class FlxObject extends FlxBasic
12541246
if (!camera.visible || !camera.exists || !isOnScreen(camera))
12551247
return;
12561248

1257-
var rect = getBoundingBox(camera);
1258-
var gfx:Graphics = beginDrawDebug(camera);
1259-
drawDebugBoundingBox(gfx, rect, allowCollisions, immovable);
1260-
endDrawDebug(camera);
1249+
final rect = getBoundingBox(camera);
1250+
if (FlxG.renderTile)
1251+
{
1252+
final PAD = 2;
1253+
final view = camera.getViewMarginRect();
1254+
view.left -= PAD;
1255+
view.top -= PAD;
1256+
view.right += PAD;
1257+
view.bottom += PAD;
1258+
rect.clipTo(view);
1259+
view.put();
1260+
}
1261+
1262+
if (rect.width > 0 && rect.height > 0)
1263+
{
1264+
final gfx = beginDrawDebug(camera);
1265+
drawDebugBoundingBox(gfx, rect, allowCollisions, immovable);
1266+
endDrawDebug(camera);
1267+
}
12611268
}
12621269

12631270
function drawDebugBoundingBox(gfx:Graphics, rect:FlxRect, allowCollisions:FlxDirectionFlags, partial:Bool)
@@ -1285,7 +1292,7 @@ class FlxObject extends FlxBasic
12851292
function drawDebugBoundingBoxColor(gfx:Graphics, rect:FlxRect, color:FlxColor)
12861293
{
12871294
// fill static graphics object with square shape
1288-
gfx.lineStyle(1, color, 0.75);
1295+
gfx.lineStyle(1, color, 0.75, false, null, null, MITER, 255);
12891296
gfx.drawRect(rect.x + 0.5, rect.y + 0.5, rect.width - 1.0, rect.height - 1.0);
12901297
}
12911298

flixel/FlxStrip.hx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ class FlxStrip extends FlxSprite
5757
continue;
5858

5959
getScreenPosition(_point, camera).subtractPoint(offset);
60-
#if !flash
6160
camera.drawTriangles(graphic, vertices, indices, uvtData, colors, _point, blend, repeat, antialiasing, colorTransform, shader);
62-
#else
63-
camera.drawTriangles(graphic, vertices, indices, uvtData, colors, _point, blend, repeat, antialiasing);
64-
#end
6561
}
6662
}
6763
}

flixel/graphics/tile/FlxDrawBaseItem.hx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class FlxDrawBaseItem<T>
1616
*/
1717
public static var drawCalls:Int = 0;
1818

19+
@:noCompletion
20+
@:deprecated("blendToInt() is deprecated, remove all references to it")
1921
public static function blendToInt(blend:BlendMode):Int
2022
{
2123
return 0; // no blend mode support in drawQuads()
@@ -29,9 +31,12 @@ class FlxDrawBaseItem<T>
2931
public var antialiasing:Bool = false;
3032
public var colored:Bool = false;
3133
public var hasColorOffsets:Bool = false;
32-
public var blending:Int = 0;
3334
public var blend:BlendMode;
3435

36+
@:noCompletion
37+
@:deprecated("blending is deprecated, remove all references to it")
38+
public var blending:Int = 0;
39+
3540
public var type:FlxDrawItemType;
3641

3742
public var numVertices(get, never):Int;

flixel/graphics/tile/FlxDrawQuadsItem.hx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class FlxDrawQuadsItem extends FlxDrawBaseItem<FlxDrawQuadsItem>
136136
camera.canvas.graphics.overrideBlendMode(blend);
137137
camera.canvas.graphics.beginShaderFill(shader);
138138
camera.canvas.graphics.drawQuads(rects, null, transforms);
139+
camera.canvas.graphics.endFill();
139140
super.render(camera);
140141
}
141142

@@ -146,4 +147,4 @@ class FlxDrawQuadsItem extends FlxDrawBaseItem<FlxDrawQuadsItem>
146147
parameter.value[0] = value;
147148
}
148149
#end
149-
}
150+
}

0 commit comments

Comments
 (0)