Debian Codegraph @

examples/user_interface/custom_cursor/README.md

raw symbols SCIP
1 # Custom Cursor
2
3 Example how to define a custom cursor in _Castle Game Engine_.
4
5 - Define a class `TCustomCursor`, descending from `TCastleUserInterface`, that contains your custom cursor. It can be any CGE UI component, like
6
7 - TCastleImageControl, to express a cursor as a simple image.
8
9 - TCastleViewport with TCastleScene, to express a cursor as a full-featured animated scene.
10
11 You can create the contents of `TCustomCursor` in various ways. We present an approach that loads a designed `xxx_cursor.castle-user-interface` file, so custom cursors can be designed in the CGE editor.
12
13 - `TCustomCursor` class also implements:
14
15 - Synchronizing the displayed cursor UI with `Container.MousePosition`.
16
17 - It must be always displayed on top, as cursor is on top of everything, using `KeepInFront`.
18
19 - To use it:
20
21 - Set `Cursor` to `mcForceNone` to hide the system cursor.
22
23 - Create `TCustomCursor` instance and add it to `Window.Controls` or inside some state. This example adds the cursor inside the `ApplicationInitialize`, so it is available in all game states.
24
25 Using [Castle Game Engine](https://castle-engine.io/).
26
27 ## Building
28
29 Compile by:
30
31 - [CGE editor](https://castle-engine.io/editor). Just use menu items _"Compile"_ or _"Compile And Run"_.
32
33 - Or use [CGE command-line build tool](https://castle-engine.io/build_tool). Run `castle-engine compile` in this directory.
34
35 - Or use [Lazarus](https://www.lazarus-ide.org/). Open in Lazarus `custom_cursor_standalone.lpi` file and compile / run from Lazarus. Make sure to first register [CGE Lazarus packages](https://castle-engine.io/lazarus).`
36
37 - Or use [Delphi](https://www.embarcadero.com/products/Delphi). Open in Delphi `custom_cursor_standalone.dproj` file and compile / run from Delphi. See [CGE and Delphi](https://castle-engine.io/delphi) documentation for details.