-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for FlxStrip when drawDebug is true
#2904
#2906
Fix for FlxStrip when drawDebug is true
#2904
#2906
Conversation
Sweet! I'll try this out later today |
Thanks! this probably saves me days of debugging |
@UncertainProd do you know what this line actually does? commenting it out seems to change nothing, and I still get bad performance when drawDebug is enabled and FlxStrips are displayed, even in ignoreDrawDebug is enabled for them regardless, things are better with your fix, but I'm left with many more questions |
Honestly, even I'm not too sure. It looks like it's meant to draw some extra stuff when drawDebug is enabled but I don't see anything different being drawn either way |
Update: I found that if you add the following 2 lines in the if (FlxG.keys.justPressed.SPACE)
{
FlxG.debugger.drawDebug = !FlxG.debugger.drawDebug;
} Turns out FlxClothSprite overrides it's |
I may have discovered the source of my performance issues, I talk about it here
yeah maybe they wanted this kind of wireframe drawing on all triangles, rather than having each FlxStrip implementing their own version, but the one in FlxDrawTrianglesItem broke, or only worked in flash and no one noticed. Then, when FlxClothSprite was introduced they unknowingly reinvented the broken wheel? |
Yeah, I think so |
does this wireframe show up even if you comment out these lines: https://github.com/UncertainProd/flixel/blob/dev/flixel/graphics/tile/FlxDrawTrianglesItem.hx#L91-L98 If so, I think we should just remove them or maybe put |
Yeah the wireframe shows up even after commenting it out |
Also, when I replace those lines with the following in FlxDrawTrianglesItem, it does outline the triangles being drawn: 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;
}
} |
Nice! I didn't know global vertex drawing was that easy, however I feel like this feature should be tied to some flag on the FlxStrip, something like |
Yeah although it did take me a bit of searching to understand how that (and drawTriangles in general) worked 😅
True |
I'm in the same boat, thanks for all you've done! |
No problem! |
Fixes #2904, I tested it on html5 and windows