Engine control to put on Lazarus form

TCastleControlBase designed in Lazarus
3D model viewer using TCastleControlBase

You need a window on the screen to display the engine content. We support two approaches to this:

  1. Create a window using TCastleWindowBase.

  2. Use TCastleControlBase inside a standard Lazarus LCL form.

Most of this manual describes the process of using the engine with the TCastleWindowBase. It is used by all new editor templates. We generally advise this approach, as:

On the other hand, using the TCastleControlBase has one big benefit: you place the control inside a Lazarus form, and you can surround it with all the standard LCL GUI controls. So you can use numerous LCL GUI controls, with native look on all desktop systems, together with Castle Game Engine. To use this:

  1. Install in Lazarus the package castle_components.lpk. In the package dialog, the option to "Install" package is under the "Use" button.

    Note: Installing the castle_components package will also automatically install the package castle_base, as a dependency. That's good.

    castle_components: Choose the file castle_components: Install castle_components: Confirm Lazarus rebuild

    Once castle_components.lpk is successfully installed, Lazarus restarts, and you should see the "Castle" tab with our components.

  2. Create a normal new project (using Lazarus "New Project" menu item). Choose "Application".

  3. Pick TCastleControlBase from the component palette (tab "Castle") and drop it on a regular Lazarus form.

  4. Press "Run" :)

See the engine examples in examples/lazarus/ subdirectory for various demos of this approach.