Unit CastleControl

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

Component with OpenGL context suitable for 2D and 3D rendering of "Castle Game Engine".

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TCastleControlBase OpenGL control, with a couple of extensions for "Castle Game Engine".
Class TCastleControlCustom OpenGL control, with extensions for "Castle Game Engine", including Controls list for TUIControl instances.
Class TCastleControl Lazarus component with an OpenGL context, most comfortable to render 3D worlds with 2D controls above.

Functions and Procedures

procedure LKeyToMyKey(const Key: Word; Shift: TShiftState; out MyKey: TKey; out MyCharKey: char);
function LMouseButtonToMyMouseButton( const MouseButton: Controls.TMouseButton; out MyMouseButton: CastleKeysMouse.TMouseButton): boolean;
procedure Register;

Constants

DefaultLimitFPS = 100.0;

Variables

LimitFPS: Single = DefaultLimitFPS;

Description

Functions and Procedures

procedure LKeyToMyKey(const Key: Word; Shift: TShiftState; out MyKey: TKey; out MyCharKey: char);

Convert Key (Lazarus key code) to my TKey.

In addition, this tries to convert Key to a character (MyCharKey). It's awful that this function has to do convertion to Char, but that's the way of VCL and LCL: KeyPress and KeyDown are separate events. While I want to have them in one event, and passed as one event to TUIControl.KeyDown.

function LMouseButtonToMyMouseButton( const MouseButton: Controls.TMouseButton; out MyMouseButton: CastleKeysMouse.TMouseButton): boolean;

Convert Lazarus Controls.TMouseButton value to my CastleKeysMouse.TMouseButton.

(By coincidence, my type name and values are the same as used by LCL; but beware — the order of values in my type is different (mbMiddle is in the middle in my type)).

procedure Register;
 

Constants

DefaultLimitFPS = 100.0;
 

Variables

LimitFPS: Single = DefaultLimitFPS;

Limit the number of (real) frames per second inside TCastleControl rendering, to not hog the CPU. Set to zero to not limit.

See TCastleWindow.ProcessMessage documentation about WaitToLimitFPS parameter, and see TGLApplication.LimitFPS documentation.

The mechanism does mean sleeping in your process, so it's a global thing, not just a property of TCastleControl. However, the mechanism is activated only when some TCastleControl component is used, and only when LCL idle is fired (so we have no pending events, as LCL idle is "lazy" and fires only when process is really idle), and not at Lazarus design time, and not when TCastleControl.AggressiveUpdate is used.


Generated by PasDoc 0.12.1 on 2013-02-04 20:26:49