Castle Lines 2D is a set of two components for Castle Game Engine
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.
Detailed usage instructions:
- Get TCastleLine2D code.
- Point your project to
TCastleLine2D
sources. E.g. add this to CastleEngineManifest.xml:
<compiler\_options>
<search\_paths>
<path value="code/" />
<path value="../../../CastleLines2D/src/" />
</search\_paths>
</compiler\_options>
- Add to
CastleEngineManifest.xml
the line editor_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.
Documentation
For detailed documentation, see Castle Lines 2D
Examples
For examples, see /CastleLines2D/examples
3 Likes
! This is fantastic And you added screenshots and documentation - perfect, thank you! I will post about it soon (in 1-2 days) on Castle Game Engine news Castle Game Engine – Open-Source 3D and 2D Game Engine and will mention it on our “Additional Components” page Additional Components | Castle Game Engine .
Many thanks, and more news soon
1 Like
Added various ways to apply texture. This allows you to create 2D platforms of any shape.
More details - Castle lines 2D: Introduction
I am very glad that you appreciated my project.
In News:
The line can have non-trivial thickness
I plan to make a dynamic line thickness based on TPiecewiseCubicBezier in the next version.
About “gizmos” and “layer_physics_simulation”
If i open “castle_game_engine/examples/advanced_editor/custom_component/”. Try to open in a file “gameviewmain.castle-user-interface”. I get the error:
The error disappears if you copy the gizmos directory.
After the error appears:
The error disappears if you copy the “layer_physics_simulation.castle-user-interface” file.
The same happens with my components. I thought it was a feature of CGE.
Oh it was an ordinary bug
I see the problem, and I can reproduce the case when the custom castle-editor indeed will not find the CGE location (thus it will not find the original editor data). The problem slipped my testing, because I usually define CASTLE_EDITOR_PATH environment variable, and then this problem doesn’t exist. But users should not need to define CASTLE_EDITOR_PATH.
… and fixed. Luckily custom CGE editor can still depend on build tool to detect proper CGE location.
Fixed in Fix custom CGE editor build - it must find CGE location, so build tool · castle-engine/castle-engine@e6e448c · GitHub . If you use binary builds on CGE from Download | Castle Game Engine , give Jenkins 6-8 hours and they will be updated with the fix. Afterwards, please test and you should see the problem gone, i.e. things should work without the need to copy the CGE editor data into each example.
2 Likes