in Engine

Castle Game Engine: Draw 2D geometry inside CGE editor using Castle Lines 2D components

From Castle Game Engine: link to original post

Castle Lines 2D demo Castle Lines 2D demo Castle Lines 2D demo Castle Lines 2D demo Castle Lines 2D - point details Castle Lines 2D - points list

I’m thrilled to present Castle Lines 2D, a set of custom CGE components done by Kumur Tash. They extend our Castle Game Engine editor functionality allowing you to draw 2D lines and polygons (possibly textured, possibly non-convex) right inside the editor!

The basic idea is that

  • you add a component TCastleLine2D or TCastlePolygon2D to a viewport,

  • right click on the component in hierarchy and select “Edit Mode ON”,

  • then just you click around to add / move / delete points (left mouse click adds/moves, right mouse click deletes).

  • The editor remains fully functional during this, so in particular e.g. zooming or panning the view works as always.

The components are open-source, on GitHub: https://github.com/KumurTash/CastleLines2D. In addition, a great usage documentation (with screenshots) and API reference are available. Go ahead, download it and test!

We have a forum thread open where you can certainly post comments and contact the author.

The polygon does not have to be convex (but it cannot be self-intersecting). It can be textured (and the texture may be repeated and scaled). The line can have non-trivial thickness and also be textured. The way line segments are connected (joints) is also configurable.

It’s really a complete code and documentation that adds to our editor something I personally never even dared to attempt. So seeing this makes my heart warm 🙂 I have to say in general that seeing others adding custom extensions to CGE and just using CGE to make cool stuff is extremely rewarding. So please everyone share what you’re doing in Show Your Projects forum category or Discord channel #show_your_projects 🙂