Code on Lazarus with TCastle2DControl


Nor can not deal with TCastle2DControl, nedujus can someone throw good source code examples for the form Lazarus.


TCastle2DControl is a descendant of TCastleControlCustom that includes a ready instance of TCastle2DSceneManager. So you place TCastle2DControl on a form, and you add scenes to the Castle2DControl1.SceneManager.Items, like

procedure TMyForm.FormCreate(...);
  MyScene: TCastle2DScene;
  MyScene := TCastle2DScene.Create(Self);
  MyScene.Translation := Vector3(10, 20, 0);

Two engine examples that use TCastle2DSceneManager are in engine sources inside

  • examples/2d_dragon_spine_game/
  • examples/physics/physics_2d_game_sopwith/

While they don’t use TCastle2DControl (instead they add TCastle2DSceneManager to a TCastleWindowCustom), but the same things are possible on TCastle2DControl.

Some links to information how to use TCastle2DScene are also on (you’re interested in the links in section " Full-featured: Render using TCastle2DScene").