flixel icon indicating copy to clipboard operation
flixel copied to clipboard

FlxStrip debug wireframe

Open Geokureli opened this issue 2 years ago • 0 comments

Continued from #2906

UncertainProd has found that replacing these lines with the following, will draw a wireframe display of FlxStrips:

if (FlxG.debugger.drawDebug)
{
	var gfx:Graphics = camera.debugLayer.graphics;
	gfx.lineStyle(1, FlxColor.BLUE, 0.5);
	// draw a triangle path for each triangle in the drawitem
	var i = 0;
	while (i < indices.length)
	{
		var indexToPoint = (idx:Int) ->
		{
			return [vertices[idx * 2], vertices[idx * 2 + 1]];
		};
		var pt1 = indexToPoint(indices[i]);
		var pt2 = indexToPoint(indices[i + 1]);
		var pt3 = indexToPoint(indices[i + 2]);
		gfx.drawPath(Vector.ofArray([MOVE_TO, LINE_TO, LINE_TO, LINE_TO]), Vector.ofArray([
			pt1[0], pt1[1],
			pt2[0], pt2[1],
			pt3[0], pt3[1],
			pt1[0], pt1[1],
		]));
		i += 3;
	}
}

I'm considering removing the original lines entirely and using this in FlxStrip with a flag to toggle this effect

Geokureli avatar Aug 30 '23 17:08 Geokureli