Class TCastleControlBase

DescriptionHierarchyFieldsMethodsProperties

Unit

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

Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public function MakeCurrent(SaveOldToStack: boolean = false): boolean; override;
Public procedure Invalidate; override;
Public procedure Paint; override;
Public procedure ReleaseAllKeysAndMouse;
Public procedure SetMousePosition(const NewMouseX, NewMouseY: Integer);
Public function SaveScreen: TRGBImage;

Properties

Public property Pressed: TKeysPressed read FPressed;
Public property MousePressed: CastleKeysMouse.TMouseButtons read FMousePressed;
Public property MouseX: Integer read FMouseX;
Public property MouseY: Integer read FMouseY;
Public property Fps: TFramesPerSecond read FFps;
Published property OnGLContextOpen: TNotifyEvent read FOnGLContextOpen write FOnGLContextOpen;
Published property OnGLContextClose: TNotifyEvent read FOnGLContextClose write FOnGLContextClose;
Published property OnBeforeDraw: TNotifyEvent read FOnBeforeDraw write FOnBeforeDraw;
Published property OnDraw: TNotifyEvent read FOnDraw write FOnDraw;
Published property TabOrder;
Published property TabStop default true;

Description

Methods

Public constructor Create(AOwner: TComponent); override;
 
Public destructor Destroy; override;
 
Public function MakeCurrent(SaveOldToStack: boolean = false): boolean; override;
 
Public procedure Invalidate; override;
 
Public procedure Paint; override;
 
Public procedure ReleaseAllKeysAndMouse;
 
Public 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.

Public 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

Public property Pressed: TKeysPressed read FPressed;
 
Public property MousePressed: CastleKeysMouse.TMouseButtons read FMousePressed;
 
Public property MouseX: Integer read FMouseX;
 
Public property MouseY: Integer read FMouseY;
 
Public property Fps: TFramesPerSecond read FFps;
 
Published property OnGLContextOpen: TNotifyEvent read FOnGLContextOpen write FOnGLContextOpen;

Called right after OpenGL context is created.

Published property OnGLContextClose: TNotifyEvent read FOnGLContextClose write FOnGLContextClose;

Called right before OpenGL context is destroyed.

Published property OnBeforeDraw: TNotifyEvent read FOnBeforeDraw write FOnBeforeDraw;
 
Published property OnDraw: TNotifyEvent read FOnDraw write FOnDraw;
 
Published property TabOrder;
 
Published property TabStop default true;
 

Generated by PasDoc 0.13.0 on 2013-08-17 21:27:12