Page 1 of 1

Visually debugging by drawing shapes

Posted: Tue Nov 28, 2017 5:35 pm
by JakSparro98
I would suggest a way for drawing debugging shapes on map editor, primitive shapes like straight lines, rectangles or circles that can be used to see visively some code algorith difficult to adjust, the color should be similar to the already existent mouse debug line used for moving objects in the editor.

A possible implementation could be:

Game.DrawLine(Vector2 FirstPoint, Vector2 SecondPoint);

Game.DrawCircle(Vector2 Position, float radius);

Game.DrawRectangle(Vector2 Min, Vector2 Max); or Game.DrawRectangle(Area Dimensions);

Typical situations where this could be useful is when you need to handle precise bounding boxes checks, visualize linked objects by a trigger/ joint (the latter is already present for joints, but the drawn links behave in a non intuitive manner, maybe related to some internal Box2D calculations) and so on.

EDIT: It could be also nice the possibility to choose if the drawing need to be filled or not (only borders or completely filled with a semi transparent layer).