You can customize the initial "Loading" image (visible when you open the application) by changing the Theme.ImagesPersistent[tiLoading] image.
Theme.ImagesPersistent[tiLoading]
This should be done in the initialization section of some unit (more specifically, it should happen before window is opened). As such, you cannot load image from disk at this moment (as on Android, you cannot read from disk from initialization sections of units). So you want to process this image first with image-to-pascal tool, to make an embedded image in a Pascal unit.
initialization
image-to-pascal
In summary, this is what you should do:
Run image2pascal GameEmbeddedImages my_loading.png (it will generate gameembeddedimages.pas unit).
image2pascal GameEmbeddedImages my_loading.png
gameembeddedimages.pas
Add a new unit that initializes Theme.ImagesPersistent[tiLoading] in the initialization:
unit GameAdjustLoadingScreen; interface uses CastleColors, CastleControls, GameEmbeddedImages; implementation initialization // Theme.LoadingBackgroundColor := Black; // adjust as needed // Theme.LoadingColor := White; // adjust as needed Theme.ImagesPersistent[tiLoading].Image := My_Loading; Theme.ImagesPersistent[tiLoading].OwnsImage := false; end.
Use the GameAdjustLoadingScreen anywhere, e.g. from GameInitialize unit.
GameAdjustLoadingScreen
GameInitialize
Notes:
The Theme.LoadingBackgroundColor determines the background underneath the "loading" image. You usually want to adjust Theme.LoadingBackgroundColor to match your my_loading.png background.
Theme.LoadingBackgroundColor
my_loading.png
The Theme.LoadingColor is a color applied to the loading image. It multiplies the color of image my_loading.png. Usually you don’t need to adjust Theme.LoadingColor if you’re already customizing the Theme.ImagesPersistent[tiLoading] image to your own.
Theme.LoadingColor
By default loading image is displayed with UI scaling that adjusts to reference size 1600x900. You can customize these properties to tweak it:
Theme.LoadingUIScaling,
Theme.LoadingUIScaling
Theme.LoadingUIReferenceWidth,
Theme.LoadingUIReferenceWidth
Theme.LoadingUIReferenceHeight.
Theme.LoadingUIReferenceHeight
To improve this documentation just edit this page and create a pull request to cge-www repository.