flixel
flixel copied to clipboard
colors don't work in FlxStrip
- Haxe version: 4.1.2
- Flixel version: 4.8.0
- OpenFL version: 8.9.6
- Lime version: 7.7.0
- Affected targets: native
Code snippet reproducing the issue:
package;
import flixel.FlxSprite;
import flixel.FlxState;
import openfl.Vector;
import flixel.FlxStrip;
import flixel.util.FlxColor;
class PlayState extends FlxState
{
override public function create():Void
{
super.create();
var testLine = new FlxStrip();
testLine.makeGraphic(10, 10, FlxColor.WHITE);
var n:Int = 0;
var indices:Array<Int> = [ n + 0, n + 1, n + 2, n + 1, n + 3, n + 2 ];
var uvtData:Array<Float> = [ 0, 0, 1, 0, 0, 1, 1, 1 ];
//var colors = [ FlxColor.WHITE, FlxColor.WHITE, FlxColor.WHITE, FlxColor.WHITE ];
var colors = [ FlxColor.RED, FlxColor.RED, FlxColor.RED, FlxColor.RED ];
testLine.indices = new Vector(indices.length, true, indices);
testLine.uvtData = new Vector(uvtData.length, true, uvtData);
testLine.colors = new Vector(colors.length, true, colors);
var vertices:Array<Float> = [];
var lineWidth = 10;
var lootboxX:Float = 20;
var lootboxY:Float = 20;
var editorX = 150;
var editorY = 150;
//vertices = [ dx, dy, dx + 23, dy, dx, dy + 8, dx + 23, dy + 8 ];
vertices = [ lootboxX, lootboxY, lootboxX + lineWidth, lootboxY, editorX, editorY, editorX + lineWidth, editorY ];
testLine.vertices = new Vector(vertices.length, true, vertices);
add(testLine);
}
}
Observed behavior:
I'm not sure if the problem is in the engine or the way I'm using FlxStrip, but colors did work on Beeblerox branch
Expected behavior:
(from Beeblerox branch)
We should open a PR to see what's different in his branch.
I think the whole renderer is different :)
Looks like newer OpenFL's drawTriangles doesn't accept colors and blending arguments :( That's why colors property isn't sent anywhere from HaxeFlixel: https://github.com/HaxeFlixel/flixel/blob/384bbc56efcc57cfd5fbbc21e31f531caea6ca67/flixel/graphics/tile/FlxDrawTrianglesItem.hx#L51