# Draw 2D geometry inside CGE editor using Castle Lines 2D components

**URL:** https://forum.castle-engine.io/t/draw-2d-geometry-inside-cge-editor-using-castle-lines-2d-components/715
**Category:** News
**Created:** [January 13, 2023, 6:50pm UTC](https://forum.castle-engine.io/t/draw-2d-geometry-inside-cge-editor-using-castle-lines-2d-components/715 "2023-01-13T18:50:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [January 13, 2023, 6:50pm UTC](https://forum.castle-engine.io/t/draw-2d-geometry-inside-cge-editor-using-castle-lines-2d-components/715/1 "2023-01-13T18:50:42Z")

</div>

| [![Castle Lines 2D demo](https://forum.castle-engine.io/uploads/default/original/2X/c/c6a8ca4da650f84416f95b52063523102b73066f.png)](https://i0.wp.com/castle-engine.io/wp/wp-content/uploads/2023/01/preview-water.png?ssl=1 "Castle Lines 2D demo") |
| [![Castle Lines 2D demo](https://forum.castle-engine.io/uploads/default/original/2X/c/cd4f2ebe42aaea05a0094f6051b0c1cba93a7d76.png)](https://i0.wp.com/castle-engine.io/wp/wp-content/uploads/2023/01/preview-gallery.png?ssl=1 "Castle Lines 2D demo") |
| [![Castle Lines 2D demo](https://forum.castle-engine.io/uploads/default/original/2X/7/79d1802237b766d2fa75a0927e399866cad9efff.png)](https://i0.wp.com/castle-engine.io/wp/wp-content/uploads/2023/01/preview.png?ssl=1 "Castle Lines 2D demo") |
| [![Castle Lines 2D demo](https://forum.castle-engine.io/uploads/default/original/2X/3/3e7bf2aac34d3c4e0dea27adb6ee0c39449545dc.png)](https://i0.wp.com/castle-engine.io/wp/wp-content/uploads/2023/01/preview-texturing.png?ssl=1 "Castle Lines 2D demo") |
| [![Castle Lines 2D - point details](https://forum.castle-engine.io/uploads/default/original/2X/5/5e660a12aa9c063e410a870ea1224ee18d8e84af.png)](https://i0.wp.com/castle-engine.io/wp/wp-content/uploads/2023/01/Zrzut-ekranu-z-2023-01-13-19-06-23.png?ssl=1 "Castle Lines 2D - point details") |
| [![Castle Lines 2D - points list](https://forum.castle-engine.io/uploads/default/original/2X/4/454e4d319b62e6921eb87c26bbfafc7349087ff5.png)](https://i0.wp.com/castle-engine.io/wp/wp-content/uploads/2023/01/Zrzut-ekranu-z-2023-01-13-19-05-40.png?ssl=1 "Castle Lines 2D - points list") |

I’m thrilled to present [Castle Lines 2D](https://github.com/KumurTash/CastleLines2D), a set of custom CGE components done by _Korchazhkin Sergey (KumurTash on GitHub)_. 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](https://kumurtash.github.io/CastleLines2D-docs/en/CastleLine2D.TCastleLine2D.html) or [TCastlePolygon2D](https://kumurtash.github.io/CastleLines2D-docs/en/CastlePolygon2D.TCastlePolygon2D.html) to a viewport, 

- You right click on the component in hierarchy and select _“Edit Mode ON”_, 

- Then you just 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](https://github.com/KumurTash/CastleLines2D). In addition, a great [usage documentation (with screenshots) and API reference are available](https://kumurtash.github.io/CastleLines2D-docs/en/index.html). Go ahead, download it and test!

[We have a forum thread open](https://forum.castle-engine.io/t/castle-lines-2d/701) 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](https://forum.castle-engine.io/c/show-your-projects/) forum category or [Discord channel `#show_your_projects`](https://castle-engine.io/talk.php) 🙂
