Class TCastleWindowDemo

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TCastleWindowDemo = class(TCastleWindowBase)

Description

Window with OpenGL context and some functionality typically useful for simple demo programs.

The additional "demo" functionality is purely optional and may be turned off by appropriate properties. And, for larger non-demo programs, I would advice to not use features of this class. For example, by default this allows user to close a window by the Escape key. This is comfortable for small demo programs, but it's too accident-prone for large programs (when you may prefer to ask user for confirmation, maybe save some game and such).

Call SetDemoOptions method to be forced to configure all "demo" options. By default they are all off.

Hierarchy

Overview

Methods

Public procedure SwapFullScreen;
Public procedure EventOpen; override;
Public procedure EventPress(const Event: TInputPressRelease); override;
Public procedure EventIdle; 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 FpsBaseCaption: string read FFpsBaseCaption write SetFpsBaseCaption;
Public property FpsCaptionUpdateInterval: TMilisecTime read FFpsCaptionUpdateInterval write FFpsCaptionUpdateInterval default DefaultFpsCaptionUpdateInterval;

Description

Methods

Public procedure SwapFullScreen;
 
Public procedure EventOpen; override;
 
Public procedure EventPress(const Event: TInputPressRelease); override;
 
Public procedure EventIdle; 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 FpsBaseCaption: string read FFpsBaseCaption write SetFpsBaseCaption;

Caption prefix to use when you have FpsShowOnCaption = True. When FpsShowOnCaption = True, you should not set Caption directly, set only this property and leave to us setting final Caption.

FpsBaseCaption will be initialized from Caption at EventOpen.

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.12.1 on 2013-02-04 20:26:53