Class TCastleApplicationProperties
Unit
Declaration
type TCastleApplicationProperties = class(TObject)
Description
Events and properties of each Castle Game Engine application, always accessed through the ApplicationProperties singleton.
The members of this class work regardless of how is the rendering context initialized, in particular regardless of whether you use CastleWindow or CastleControl. For various other application properties and methods use
TCastleApplication class, using the CastleWindow.Application singleton (if you use CastleWindow).
TApplicationclass, using theApplicationsingleton, in Lazarus LCL or Delphi VCL or FMX (in case you use CastleControl).
Source: src/base/castleapplicationproperties.pas (line 65).
Hierarchy
- TObject
- TCastleApplicationProperties
Overview
Fields
![]() |
nested const DefaultLimitFPS = 120.0; |
![]() |
nested const PlatformAllowsModalRoutines = true ; |
Methods
![]() |
constructor Create; |
![]() |
destructor Destroy; override; |
![]() |
function CanCatchExceptions: Boolean; |
![]() |
procedure AddInitializeDebugListener(const Listener: TProcedure); |
![]() |
procedure WriteWarningOnConsole(const Category, Message: String); |
![]() |
function Description: String; |
![]() |
procedure InitializeDebug; |
![]() |
procedure InitializeRelease; |
![]() |
procedure FreeDelayed(const Item: TComponent); |
Properties
![]() |
property ApplicationName: String read GetApplicationName write SetApplicationName; |
![]() |
property Caption: String read FCaption write FCaption; |
![]() |
property Version: String read FVersion write FVersion; |
![]() |
property TouchDevice: boolean read FTouchDevice write FTouchDevice; |
![]() |
property ShowUserInterfaceToQuit: Boolean
read FShowUserInterfaceToQuit write FShowUserInterfaceToQuit; |
![]() |
property LimitFPS: Single read FLimitFPS write FLimitFPS default DefaultLimitFPS ; |
![]() |
property OnGLContextEarlyOpen: TGLContextEventList read FOnGLContextEarlyOpen; |
![]() |
property OnGLContextOpen: TGLContextEventList read FOnGLContextOpen; |
![]() |
property OnGLContextOpenObject: TNotifyEventList read FOnGLContextOpenObject; |
![]() |
property OnGLContextClose: TGLContextEventList read FOnGLContextClose; |
![]() |
property OnGLContextCloseObject: TNotifyEventList read FOnGLContextCloseObject; |
![]() |
property IsGLContextOpen: boolean read FIsGLContextOpen; |
![]() |
property OnUpdate: TNotifyEventList read FOnUpdate; |
![]() |
property OnInitializeJavaActivity: TNotifyEventList read FOnInitializeJavaActivity; |
![]() |
property OnPause: TNotifyEventList read FOnPause; |
![]() |
property OnResume: TNotifyEventList read FOnResume; |
![]() |
property OnWarning: TWarningEventList read FOnWarning; |
![]() |
property OnLog: TLogEventList read FOnLog; |
Description
Fields
![]() |
nested const DefaultLimitFPS = 120.0; |
|
This item has no description. | |
![]() |
nested const PlatformAllowsModalRoutines = true ; |
|
Some platforms do not support Application.ProcessMessage, which means you cannot just write a function like MessageYesNo that waits until user clicks something. You *have* to implement modal boxes then using views, e.g. using CastleDialogViews or your own TCastleView descendants. | |
Methods
![]() |
constructor Create; |
|
This item has no description. | |
![]() |
destructor Destroy; override; |
|
This item has no description. | |
![]() |
function CanCatchExceptions: Boolean; |
|
We can catch exceptions on this platform. So "try .. except" works reliably and you can use exceptions to report error-like conditions, and later recover from them. This is Source: src/base/castleapplicationproperties.pas (line 184). | |
![]() |
procedure AddInitializeDebugListener(const Listener: TProcedure); |
|
Events called at InitializeDebug. If InitializeDebug was already called, then we call the listener now, from this Source: src/base/castleapplicationproperties.pas (line 304). | |
![]() |
procedure WriteWarningOnConsole(const Category, Message: String); |
|
Add this to OnWarning to output warnings to standard output (usually, console). Eventually, on GUI Windows programs, it will make a dialog box. This is handled by WarningWrite procedure. Source: src/base/castleapplicationproperties.pas (line 309). | |
![]() |
function Description: String; |
|
Print some common information about application, for example to use in –help command-line output. It shows application name, version, CGE version, compiler version, platform. Includes the output of SCompilerDescription and SPlatformDescription. Source: src/base/castleapplicationproperties.pas (line 354). | |
![]() |
procedure InitializeDebug; |
|
Initialize debug facilities, that should not be enabled in released applications, but are very useful when enabled out-of-the-box during development. Must be called early (before any files are loaded). This includes now:
This is called automatically from auto-generated CastleAutoGenerated unit in each project, if the DEBUG symbol was defined during compilation. For backward compatibility, it is also called when the CGE units like CastleInternalFileMonitor and CastleUiControls are compiled with the DEBUG symbol, but please don't depend on this, it will be removed in future engine versions. You shall not depend on DEBUG / RELEASE symbols used when compiling the engine, they may be independent from the project DEBUG / RELEASE symbols. Source: src/base/castleapplicationproperties.pas (line 381). | |
![]() |
procedure InitializeRelease; |
|
Enable release features at run-time. This does *nothing* for now, but enables possible future extensions (e.g. special optimizations). Source: src/base/castleapplicationproperties.pas (line 386). | |
![]() |
procedure FreeDelayed(const Item: TComponent); |
|
Free given component, at the nearest suitable moment. The pending free operations are done at least after processing all "update" events and before processing the "render" event (so the items pending to be freed will not be rendered). Source: src/base/castleapplicationproperties.pas (line 392). | |
Properties
![]() |
property ApplicationName: String read GetApplicationName write SetApplicationName; |
|
Application short name. Used e.g. by InitializeLog to name the log file. When compiled with FPC, this returns and sets the same thing as standard SysUtils.ApplicationName. When setting this, we automatically set SysUtils.OnGetApplicationName. Source: src/base/castleapplicationproperties.pas (line 107). | |
![]() |
property Caption: String read FCaption write FCaption; |
|
Pretty application name, to show to user e.g. as a window caption. Source: src/base/castleapplicationproperties.pas (line 110). | |
![]() |
property Version: String read FVersion write FVersion; |
|
Version of this application. It may be used e.g. by InitializeLog and TCastleApplication.ParseStandardParameters. Source: src/base/castleapplicationproperties.pas (line 115). | |
![]() |
property TouchDevice: boolean read FTouchDevice write FTouchDevice; |
|
Initialized to On such devices:
See documentation about touch input. As a debugging feature, you can set this to
// show the button only on mobile
ButtonExit.Exists := ApplicationProperties.TouchDevice;
To test on desktop whether everything behaves OK on mobile, you can just earlier call this: if DebugTouchDeviceOnDesktop then ApplicationProperties.TouchDevice := true;
If you use our standard initialization using TCastleWindow.ParseParameters, you can also pass command-line option Source: src/base/castleapplicationproperties.pas (line 165). | |
![]() |
property ShowUserInterfaceToQuit: Boolean
read FShowUserInterfaceToQuit write FShowUserInterfaceToQuit; |
|
Is it common, on current platform, to show the "Quit" button in your application. E.g. it is normal to show "Quit" on PC (Windows, Linux etc.). But on mobile devices and consoles (like Nintendo Switch) you should not show "Quit", it is expected that user knows how to use OS-specific mechanism to just switch to a different application. Just like the TouchDevice, you can change this at runtime for debug purposes (to e.g. easily test mobile UI on PC). Source: src/base/castleapplicationproperties.pas (line 175). | |
![]() |
property LimitFPS: Single read FLimitFPS write FLimitFPS default DefaultLimitFPS ; |
|
Limit the number of (real) frames per second, to not hog the CPU. Set to zero to not limit. The mechanism is implemented by occasionally sleeping (when we see that we render way faster than we need to). So it's a global thing, not just a property of TCastleWindow or TCastleControl. In some cases, this also means the "desired number of FPS". This happens when we may be clogged with events (which is especially possible in case of mouse look, when we use CastleControl, or when we use CastleWindow with LCL backend). In such cases we try hard to call "update" and (if necessary) "render" events at least as often as
Source: src/base/castleapplicationproperties.pas (line 223). | |
![]() |
property OnGLContextEarlyOpen: TGLContextEventList read FOnGLContextEarlyOpen; |
|
Called before OnGLContextOpen, even before Application.OnInitialize, but after we can read files. Source: src/base/castleapplicationproperties.pas (line 227). | |
![]() |
property OnGLContextOpen: TGLContextEventList read FOnGLContextOpen; |
|
Callbacks called when the OpenGL context is opened or closed. Use when you want to be notified about OpenGL context availability, but cannot refer to a particular instance of TCastleControl or TCastleWindow. Note that we may have many OpenGL contexts (many TCastleWindow or TCastleControl instances) open simultaneously. They all share OpenGL resources. Callbacks on Source: src/base/castleapplicationproperties.pas (line 249). | |
![]() |
property OnGLContextOpenObject: TNotifyEventList read FOnGLContextOpenObject; |
|
This item has no description. Source: src/base/castleapplicationproperties.pas (line 250). | |
![]() |
property OnGLContextClose: TGLContextEventList read FOnGLContextClose; |
|
This item has no description. Source: src/base/castleapplicationproperties.pas (line 251). | |
![]() |
property OnGLContextCloseObject: TNotifyEventList read FOnGLContextCloseObject; |
|
This item has no description. Source: src/base/castleapplicationproperties.pas (line 252). | |
![]() |
property IsGLContextOpen: boolean read FIsGLContextOpen; |
|
Is the OpenGL context available. IOW, we are between the first OnGLContextOpen and last OnGLContextClose. Source: src/base/castleapplicationproperties.pas (line 257). | |
![]() |
property OnUpdate: TNotifyEventList read FOnUpdate; |
|
Callbacks called continuously when (at least one) window is open. Source: src/base/castleapplicationproperties.pas (line 260). | |
![]() |
property OnInitializeJavaActivity: TNotifyEventList read FOnInitializeJavaActivity; |
|
Callbacks called when Android Java activity started. Called every time a Java activity is created.
For non-Android applications, this is simply always called exactly once, exactly before calling TCastleApplication.OnInitialize. Source: src/base/castleapplicationproperties.pas (line 285). | |
![]() |
property OnPause: TNotifyEventList read FOnPause; |
|
Callbacks called when Android Java activity is paused or resumed. For now not called on non-Android, but this may change — consider these events somewhat internal for the time being. Source: src/base/castleapplicationproperties.pas (line 291). | |
![]() |
property OnResume: TNotifyEventList read FOnResume; |
|
This item has no description. Source: src/base/castleapplicationproperties.pas (line 292). | |
![]() |
property OnWarning: TWarningEventList read FOnWarning; |
|
Events called upon WritelnWarning. Source: src/base/castleapplicationproperties.pas (line 296). | |
![]() |
property OnLog: TLogEventList read FOnLog; |
|
Events called upon any WritelnLog, including WritelnWarning. Source: src/base/castleapplicationproperties.pas (line 299). | |
Generated by PasDoc 0.17.0.snapshot.
