Installing Castle Game Engine packages in Delphi allows to:
Have "Tools → Castle Game Engine" menu available, with useful commands like "Set Engine Path…" and "Configure Delphi to Use Engine". These commands are used to set up the Delphi IDE to use CGE units and tools.
Necessary DLLs will be automatically deployed alongside your EXE file, if you build a project with CastleEngineManifest.xml from Delphi IDE. These DLLs follow the declared
<dependencies> of your project along with some auto-detected dependencies (e.g. we automatically deploy OpenAL DLLs if your project includes sound files in data).
Open in Delphi
Right-click on all packages (except
castle_engine_window.bpl) in succession and click "Install".
|The platform of all our packages is set by default to "Windows 32-bit" and this is good, this is what you want to use for installation, since Delphi IDE is a Win32 application. The packages installed this way make CGE components available for all supported target platforms (including Win32, Win64, and Linux64).
Use the new menu item "Tools → Castle Game Engine → Set Engine Path…" to tell Delphi where is the CGE root directory. It should contain subdirectories like
examples. Don’t worry, we validate what you select, we will not let you select an invalid directory.
Use the menu item "Tools → Castle Game Engine → Configure Delphi to Use Engine".
Restart Delphi IDE, as adviced by the message that will appear.
|Restart is really necessary, as changing "Library Path" in Delphi has to be done using the registry and Delphi will load new values only on restart.
This simply modifies the global "Library Path" for all your Delphi platforms. You can visit "Tools → Options → Language → Delphi → Library → Library Path" (after restarting Delphi!) to see what it did. This way CGE source code is available to all your projects, and CGE units will be compiled and linked with your projects that use any
If you want, instead of "Configure Delphi to Use Engine", you can also configure a particular project using menu item "Configure Only Current Project (for Current Platform and Debug/Release Config) to Use Engine".
The latter option, "Configure Only Current Project (for Current Platform and Debug/Release Config) to Use Engine", doesn’t touch the global Delphi settings, it only modifies the current project. It also doesn’t need Delphi restart. It is less recommended because:
You will have to repeat this operation for every project, every platform, every config (debug/release).
The resulting DPROJ will contain absolute paths to CGE sources, so it will not work for other developers if you share your project e.g. using a version control.
But the option remains. Good if you just want to try CGE locally.
|There’s no point activating both global ("Configure Delphi to Use Engine") and project ("Configure Only Current Project (for Current Platform and Debug/Release Config) to Use Engine") settings. Only one of them is necessary, and any one of them is enough.
More information about how and why CGE packages for Delphi are designed is in the Delphi packages README file in sources.
If you are interested in developing Delphi IDE extensions, you may find it useful to take a look at our test project https://github.com/michaliskambi/delphi-test-package-design-features . This is small, independent of CGE, piece of Pascal code demonstrating how to extend Delphi IDE — adding new menu items, changing project and global options. We used it as a "test bed" to develop the CGE integration, and it may be useful for you too.