Castle Game EngineIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers
|
Class TCastleApplicationProperties
Unit
CastleApplicationProperties
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
Methods
Properties
Description
Methods
 |
constructor Create; |
|
 |
destructor Destroy; override; |
|
 |
procedure WriteWarningOnConsole(Sender: TObject; 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.
|
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 TouchDevice: boolean read FTouchDevice write FTouchDevice; |
Initialized to True on touch devices (Android, iOS).
A "touch device" means that:
As a debugging feature, you can set this to True to simulate touch devices on a desktop. The idea is that when an application shows a different input behaviour on touch devices, it should always condition it depending on this boolean property. So an application may do this:
Window.AutomaticTouchInterface := ApplicationProperties.TouchDevice;
Window.ScenaManager.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 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. OnGLContextOpen is called when first OpenGL context is open, that is: no previous context was open. OnGLContextClose is called when last OpenGL context is closed, that is: no more contexts remain open. Note that this implies that they may be called many times: e.g. if you open one window, then close it, then open another window then close it.
Callbacks on OnGLContextOpen are called from first to last. Callbacks on OnGLContextClose are called in reverse order, so OnGLContextClose[0] is called last.
|
 |
property IsGLContextOpen: boolean read FIsGLContextOpen; |
Is the OpenGL context available. IOW, we are between the first OnGLContextOpen and last OnGLContextClose.
|
 |
property OnInitializeJavaActivity: TNotifyEventList read FOnInitializeJavaActivity; |
Callbacks called when Android Java activity started. Called every time a Java activity is created.
For the first time, it's called right before TCastleApplication.OnInitialize.
Later this is called when Java activity died (and is restarting now), but the native code thread survived. So all native code memory is already cool (no need to call TCastleApplication.OnInitialize), but we need to reinitialize Java part.
Note that this is different from TCastleWindowCustom.OnOpen. We lose OpenGL context often, actually every time user switches to another app, without having neither Java nor native threads killed.
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.
|
Generated by PasDoc 0.15.0.
|