Castle Lines 2D is a set of two components for Castle Game Engine (https://castle-engine.io/).
Castle Lines 2D makes it possible to create geometry from polygons directly in the CGE editor.
Castle Lines 2D consists of classes inherited from TCastleAbstractPrimitive:
TCastleLine2D - polyline.
TCastlePolygon2D - potentially non-convex polygon.
To enter the editing mode, use the drop-down menus in the object hierarchy window
Left mouse button - add a point, move a point.
Right mouse button - delete a point.
Middle mouse button - open a window for editing a point.
-
Get TCastleLine2D code.
-
Point your project to
TCastleLine2D
sources. E.g. add this toCastleEngineManifest.xml:
<compiler_options> <search_paths> <path value="code/" /> <path value="../../../CastleLines2D/src/" /> </search_paths> </compiler_options>
-
Add to
CastleEngineManifest.xml
the lineeditor_units="CastleLine2D,CastlePolygon2D"
.
See CastleEngineManifest.xml docs for examples. -
Open your project in CGE editor and use “Project -> Restart Editor (With Custom Components)”
-
In Lazarus don't forget to add the source path to “Project Options -> Compiler Options -> Paths -> Other unit files”
-
Be sure to also add
CastleLine2D, CastlePolygon2D
to some uses clause, to register components at runtime.
For detailed documentation, see https://kumurtash.github.io/CastleLines2D-docs/index.html
For examples, see /CastleLines2D/examples
12.01.2023
Added various ways to apply texture to TCastleLine2D, TCastlePolygon2D.
The Shift key now helps to draw straight lines.
In CastlePolygon2D added property - Area
Bugs fixed.