Castle Game Engine: CastleControl: Class TCastleControlBase

# Class TCastleControlBase
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleControl ## Declaration `type TCastleControlBase = class(TOpenGLControl)` ## Description OpenGL control, with a couple of extensions for "Castle Game Engine". You should usually use descendants TCastleControl or (less likely) TCastleControlCustom instead of using directly this class, as the descendants add important features like TCastleControlCustom.Controls or TCastleControl.SceneManager. Extends TOpenGLControl with various utilities: OnGLContextOpen and OnGLContextClose events and GLInitialized property. Continously called `UpdateEvent` method, that allows to handle TUIControl.Update. This is something different than LCL "idle" event, as it's guaranteed to be run continously, even when your application is clogged with events (like when using TWalkCamera.MouseLook). Automatically calls LoadAllExtensions when OpenGL context is initialized. This will initialize all extensions and set GLVersion variables, describing OpenGL version and available extensions. FPS (frames per second) counter inside Fps. Tracks pressed keys Pressed and mouse buttons MousePressed and mouse position (MouseX, MouseY). ## Hierarchy TOpenGLControl TCastleControlBase ## Overview ### Methods
| `constructor Create(AOwner: TComponent); override;`
| `destructor Destroy; override;`
| `function MakeCurrent(SaveOldToStack: boolean = false): boolean; override;`
| `procedure Invalidate; override;`
| `procedure Paint; override;`
| `procedure ReleaseAllKeysAndMouse;`
| `procedure SetMousePosition(const NewMouseX, NewMouseY: Integer);`
| `function SaveScreen: TRGBImage;`
### Properties
| `property Pressed: TKeysPressed read FPressed;`
| `property MousePressed: CastleKeysMouse.TMouseButtons read FMousePressed;`
| `property MouseX: Integer read FMouseX;`
| `property MouseY: Integer read FMouseY;`
| `property Fps: TFramesPerSecond read FFps;`
| `property OnGLContextOpen: TNotifyEvent read FOnGLContextOpen write FOnGLContextOpen;`
| `property OnGLContextClose: TNotifyEvent read FOnGLContextClose write FOnGLContextClose;`
| `property OnBeforeDraw: TNotifyEvent read FOnBeforeDraw write FOnBeforeDraw;`
| `property OnDraw: TNotifyEvent read FOnDraw write FOnDraw;`
| `property TabOrder;`
| `property TabStop default true;`
## Description ### Methods
| `constructor Create(AOwner: TComponent); override;`
| `destructor Destroy; override;`
| `function MakeCurrent(SaveOldToStack: boolean = false): boolean; override;`
| `procedure Invalidate; override;`
| `procedure Paint; override;`
| `procedure ReleaseAllKeysAndMouse;`
| `procedure SetMousePosition(const NewMouseX, NewMouseY: Integer);`
Place mouse cursor at NewMouseX and NewMouseY. Position is specified relative to this window's upper-top corner (more specifically, OpenGL area upper-top corner), just like MouseX and MouseY properties. Note that the actually set position may be different than requested, for example if part of the window is offscreen then window manager will probably refuse to move mouse cursor offscreen. This may generate normal OnMouseMove event, just as if the user moved the mouse. But it's also allowed to not do this. Ignored when window is closed.
| `function SaveScreen: TRGBImage;`
Capture the current control contents to an image. These functions take care of flushing any pending redraw operations and capturing the screen contents correctly.
### Properties
| `property Pressed: TKeysPressed read FPressed;`
| `property MousePressed: CastleKeysMouse.TMouseButtons read FMousePressed;`
| `property MouseX: Integer read FMouseX;`
| `property MouseY: Integer read FMouseY;`
| `property Fps: TFramesPerSecond read FFps;`
| `property OnGLContextOpen: TNotifyEvent read FOnGLContextOpen write FOnGLContextOpen;`
Called right after OpenGL context is created.
| `property OnGLContextClose: TNotifyEvent read FOnGLContextClose write FOnGLContextClose;`
Called right before OpenGL context is destroyed.
| `property OnBeforeDraw: TNotifyEvent read FOnBeforeDraw write FOnBeforeDraw;`
| `property OnDraw: TNotifyEvent read FOnDraw write FOnDraw;`
| `property TabOrder;`
| `property TabStop default true;`
Generated by PasDoc 0.13.0 on 2013-08-17 21:27:12