flixel icon indicating copy to clipboard operation
flixel copied to clipboard

colors don't work in FlxStrip

Open starry-abyss opened this issue 4 years ago • 3 comments

  • 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

image

Expected behavior:

(from Beeblerox branch)

image

starry-abyss avatar Jul 22 '20 10:07 starry-abyss

We should open a PR to see what's different in his branch.

bhgsbatista avatar Aug 27 '20 03:08 bhgsbatista

I think the whole renderer is different :)

starry-abyss avatar Aug 27 '20 12:08 starry-abyss

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

starry-abyss avatar Dec 13 '20 18:12 starry-abyss