Class TCastleApplicationProperties
Unit
Declaration
type TCastleApplicationProperties = class(TObject)
Description
Events and properties of the Castle Game Engine application, usually accessed through the ApplicationProperties singleton.
These members work regardless if you use CastleWindow or CastleControl. For more fine-grained application control, see TCastleApplication (in case you use CastleWindow) or Lazarus (LCL) TApplication (in case you use CastleControl).
Hierarchy
- TObject
- TCastleApplicationProperties
Overview
Fields
nested const DefaultLimitFPS = 100.0; |
|
nested const PlatformAllowsModalRoutines = true ; |
Methods
constructor Create; |
|
destructor Destroy; override; |
|
procedure WriteWarningOnConsole(const Category, Message: String); |
|
function Description: String; |
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 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 = 100.0; |
|
nested const PlatformAllowsModalRoutines = true ; |
|
Some platforms do not support Application.ProcessMessages, which means you cannot just write a function like MessageYesNo that waits until user clicks something. You *have* to implement modal boxes then using states, e.g. using CastleDialogStates or your own TUIState descendants. |
Methods
constructor Create; |
|
destructor Destroy; override; |
|
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. |
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. |
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. |
property Caption: String read FCaption write FCaption; |
|
Pretty application name, to show to user e.g. as a window caption. |
property Version: String read FVersion write FVersion; |
|
Version of this application. It may be used e.g. by InitializeLog and TCastleApplication.ParseStandardParameters. |
property TouchDevice: boolean read FTouchDevice write FTouchDevice; |
|
Initialized to A "touch device" means that:
As a debugging feature, you can set this to
Viewport.WalkCamera.MouseLook := not ApplicationProperties.TouchDevice;
And to test on desktop whether everything behaves OK on mobile, you can just earlier call this: if FakeTouchDeviceOnDesktop then ApplicationProperties.TouchDevice := true; |
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). |
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
|
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 |
property OnGLContextOpenObject: TNotifyEventList read FOnGLContextOpenObject; |
|
property OnGLContextClose: TGLContextEventList read FOnGLContextClose; |
|
property OnGLContextCloseObject: TNotifyEventList read FOnGLContextCloseObject; |
|
property IsGLContextOpen: boolean read FIsGLContextOpen; |
|
Is the OpenGL context available. IOW, we are between the first OnGLContextOpen and last OnGLContextClose. |
property OnUpdate: TNotifyEventList read FOnUpdate; |
|
Callbacks called continuously when (at least one) window is open. You can use this just like TCastleControl.OnUpdate or TCastleWindow.OnUpdate or TCastleApplication.OnUpdate. |
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. |
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. |
property OnResume: TNotifyEventList read FOnResume; |
|
property OnWarning: TWarningEventList read FOnWarning; |
|
Events called upon WritelnWarning. |
property OnLog: TLogEventList read FOnLog; |
|
Events called upon any WritelnLog, including WritelnWarning. |
Generated by PasDoc 0.16.0.