Class TCastleControlContainer
Unit
Declaration
type TCastleControlContainer = class(TCastleContainer)
Description
This item has no description. Showing description inherited from TCastleContainer.
Abstract user interface container. Connects OpenGL context management code with Castle Game Engine controls (TCastleUserInterface, that is the basis for all our 2D and 3D rendering). When you use TCastleWindow (a window) or TCastleControl (Lazarus component), they provide you a non-abstract implementation of TCastleContainer
.
Basically, this class manages a Controls list.
We pass our inputs (mouse / key / touch events) to the controls on this list. Input goes to the front-most (that is, last on the Controls list) control under the event position (or mouse position, or the appropriate touch position). We use TCastleUserInterface.CapturesEventsAtPosition to decide this (by default it simply checks control's TCastleUserInterface.RenderRect vs the given position). As long as the event is not handled, we search for the next control that can handle this event and returns TCastleUserInterface.CapturesEventsAtPosition = True
.
We also call various methods to every control. These include TCastleUserInterface.Update, TCastleUserInterface.Render, TCastleUserInterface.Resize.
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastleContainer
- TCastleControlContainer
Overview
Fields
class var UpdatingEnabled: Boolean; |
Methods
procedure AdjustContext(const PlatformContext: TGLContext); virtual; |
|
procedure InitializeContext; |
|
procedure FinalizeContext; |
|
procedure DoRender; |
|
class procedure DoUpdateEverything; |
|
class procedure UpdatingEnable; virtual; abstract; |
|
class procedure UpdatingDisable; virtual; abstract; |
|
constructor Create(AOwner: TComponent); override; |
|
destructor Destroy; override; |
|
function SaveScreen(const SaveRect: TRectangle): TRGBImage; overload; override; |
|
function GLInitialized: boolean; override; |
|
procedure MakeContextCurrent; |
|
function DesignedComponent(const ComponentName: String; const Required: Boolean = true): TComponent; |
Properties
property AutoRedisplay: Boolean read FAutoRedisplay write SetAutoRedisplay
default true; |
|
property Requirements: TGLContextRequirements read FRequirements; |
|
property DesignUrl: String read FDesignUrl write SetDesignUrl; |
Description
Fields
class var UpdatingEnabled: Boolean; |
|
"Updating" means that the mechanism to call DoUpdateEverything continuosly is set up. |
Methods
procedure AdjustContext(const PlatformContext: TGLContext); virtual; |
|
Adjust context parameters right before usage. |
procedure InitializeContext; |
|
Call these methods from final components that wrap TCastleControlContainer, like TCastleControl, TCastleWindow. |
procedure FinalizeContext; |
|
This item has no description. |
procedure DoRender; |
|
This item has no description. |
class procedure DoUpdateEverything; |
|
This item has no description. |
class procedure UpdatingEnable; virtual; abstract; |
|
This item has no description. |
class procedure UpdatingDisable; virtual; abstract; |
|
This item has no description. |
constructor Create(AOwner: TComponent); override; |
|
This item has no description. |
destructor Destroy; override; |
|
This item has no description. |
function SaveScreen(const SaveRect: TRectangle): TRGBImage; overload; override; |
|
This item has no description. |
function GLInitialized: boolean; override; |
|
Is OpenGL(ES) context initialized for this container. |
procedure MakeContextCurrent; |
|
Make given OpenGL(ES) context current. Can only be used if GLInitialized. |
function DesignedComponent(const ComponentName: String; const Required: Boolean = true): TComponent; |
|
When the DesignUrl is set you can use this method to find loaded components. Like this: MyButton := MyCastleControl.Container.DesignedComponent('MyButton') as TCastleButton;
When the name is not found, raises exception (unless Required is See also
|
Properties
property AutoRedisplay: Boolean read FAutoRedisplay write SetAutoRedisplay
default true; |
|
Should we automatically redraw the window all the time, without the need for an Invalidate call. If If your game may have a still screen (nothing animates), then this approach is a little unoptimal, as we use CPU and GPU for drawing, when it's not needed. In such case, you can set this property to |
property Requirements: TGLContextRequirements read FRequirements; |
|
Context required parameters. |
property DesignUrl: String read FDesignUrl write SetDesignUrl; |
|
Load and show the design (.castle-user-interface file). You can reference the loaded components by name using DesignedComponent. If you have more complicated control flow, we recommend to leave this property empty, and split your management into a number of states (TCastleView) instead. In this case, load design using TCastleView.DesignUrl. This property makes it however easy to use .castle-user-interface in simple cases, e.g. when TCastleControl just shows one UI. The design loaded here is visible also at design-time, when editing the form in Lazarus/Delphi. Though we have to way to edit it now in Lazarus/Delphi (you have to use CGE editor to edit the design), so it is just a preview in this case. See https://castle-engine.io/control_on_form for documentation how to use TCastleControl. |
Generated by PasDoc 0.16.0-snapshot.