Geometric Shapes
Drawing geometric shapes to the console!
Terminaux also provides a wide assortment of classes that allow you to render different geometric shapes to the console easily.
Implementation
They implement the GraphicalCyclicWriter and the CyclicWriter classes to allow you to iteratively render different geometric shapes from arrays of shapes that you can loop through to speed up the process and to allow you to implement your custom geometric shape.
You can also store these shapes in a container and render them iteratively using the Container class. For line rendering, we recommend that you rely on the cyclic writer and its renderables.
Rendering a shape
To render a geometric shape, such as a rectangle, to the console, you must create a new instance of a shape class, providing the width and the height of the shape, as well as the position that tells Terminaux where to render the shape, whether to render the outline or the full shape (optional), and the selected color (optional).
After creating a new instance, just call Render() on the shape instance.
var rect = new Rectangle(7, 5, 4, 2, true, ConsoleColors.Red);
var rect2 = new Rectangle(7, 5, 21, 2, false, ConsoleColors.Aqua);
TextWriterRaw.WriteRaw(rect.Render());
TextWriterRaw.WriteRaw(rect2.Render());
It's up to your shape class to have a constructor that doesn't necessarily require all the shape arguments as outlined above.
List of shapes
Here are the shapes that you can use:
Last updated




















