Class TCastleWindowDemo

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TCastleWindowDemo = class(TCastleWindowBase)

Description

Window with OpenGL context and some helper functionality, useful for demo programs. This includes key shortcuts to close the window, switch FullScreen, and to display FPS on window caption.

Hierarchy

Overview

Methods

Public procedure EventPress(const Event: TInputPressRelease); override;
Public procedure EventUpdate; override;
Public function AllowSuspendForInput: boolean; override;
Public procedure SetDemoOptions(ASwapFullScreen_Key: TKey; AClose_CharKey: char; AFpsShowOnCaption: boolean);
Public constructor Create(AOwner: TComponent); override;

Properties

Public property FpsShowOnCaption: boolean read FFpsShowOnCaption write FFpsShowOnCaption default false;
Public property SwapFullScreen_Key: TKey read FSwapFullScreen_Key write FSwapFullScreen_Key default K_None;
Public property Close_CharKey: char read FClose_CharKey write FClose_CharKey default #0;
Public property FpsCaptionUpdateInterval: TMilisecTime read FFpsCaptionUpdateInterval write FFpsCaptionUpdateInterval default DefaultFpsCaptionUpdateInterval;

Description

Methods

Public procedure EventPress(const Event: TInputPressRelease); override;
 
Public procedure EventUpdate; override;
 
Public function AllowSuspendForInput: boolean; override;
 
Public procedure SetDemoOptions(ASwapFullScreen_Key: TKey; AClose_CharKey: char; AFpsShowOnCaption: boolean);
 
Public constructor Create(AOwner: TComponent); override;
 

Properties

Public property FpsShowOnCaption: boolean read FFpsShowOnCaption write FFpsShowOnCaption default false;

Show current frames per second on window caption. You can modify this property only before calling Open.

Public property SwapFullScreen_Key: TKey read FSwapFullScreen_Key write FSwapFullScreen_Key default K_None;

Key to use to switch between FullScreen and not FullScreen. Set to K_None (default) to disable this functionality. Suggested value to enable this functionality is K_F11, this is consistent will fullscreen key in other programs. You can freely modify it at any time, even after calling Open.

The fullscreen is switched by closing it, changing FullScreen property and opening it again. So be sure to have good OnOpen / OnClose implementations: you have to be able to recreate in OnOpen everything that was released in OnClose.

Public property Close_CharKey: char read FClose_CharKey write FClose_CharKey default #0;

Key to use to close the window. Set to #0 (default) to disable this functionality. Suggested value to enable this functionality is CharEscape. You can freely modify it at any time, even after calling Open.

Public property FpsCaptionUpdateInterval: TMilisecTime read FFpsCaptionUpdateInterval write FFpsCaptionUpdateInterval default DefaultFpsCaptionUpdateInterval;

The amount of time (in miliseconds) between updating Caption with current FPS value. Used when FpsShowOnCaption.

Note that updating Caption of the window too often may cause a significant FPS dropdown, in other words: don't set this to too small value. I once used here value 200. It's 5 times per second, this didn't seem too often, until once I checked my program with this turned off and found that my program runs now much faster (you can see that looking at FpsRealTime (FpsFrameTime does not change)).

That's why I use here quite big value by default, DefaultFpsCaptionUpdateInterval.

If you really want to show FPS counts updated more constantly, you should display them each frame as a text in OpenGL (like I do in view3dscene).


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