Class TCastleNotifications

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TCastleNotifications = class(TUIControl)

Description

Notifications displayed in the OpenGL window. The idea is to display messages about something happening at the bottom / top of the screen. These messages disappear by themselves after some short time.

Similar to older FPS games messages, e.g. DOOM, Quake, Duke Nukem 3D. Suitable for game messages like "Picked up 20 ammo" or "Player Foo joined game".

This is a TUIControl descendant, so to use it — just add it to TCastleWindowCustom.Controls or TCastleControlCustom.Controls. Call Show to display a message.

Hierarchy

Overview

Fields

Public internal const DefaultMaxMessages = 4;
Public internal const DefaultMessagesTimeout = 5000;
Public internal const DefaultHorizontalPosition = hpMiddle;
Public internal const DefaultVerticalPosition = vpDown;
Public internal const DefaultHorizontalMargin = 10;
Public internal const DefaultVerticalMargin = 1;

Methods

Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure Show(const s: string); overload;
Public procedure Show(s: TStringList); overload;
Public procedure Clear;
Public procedure Update(const SecondsPassed: Single; var HandleInput: boolean); override;
Public procedure Render; override;
Public function GetExists: boolean; override;

Properties

Public property Color: TCastleColor read FColor write FColor;
Public property History: TCastleStringList read FHistory;
Public property PositionX: Integer read FPositionX write FPositionX;
Public property PositionY: Integer read FPositionY write FPositionY;
Published property MaxMessages: integer read FMaxMessages write FMaxMessages default DefaultMaxMessages;
Published property Timeout: TMilisecTime read FTimeout write FTimeout default DefaultMessagesTimeout;
Published property HorizontalPosition: THorizontalPosition read FHorizontalPosition write FHorizontalPosition default DefaultHorizontalPosition;
Published property VerticalPosition: TVerticalPosition read FVerticalPosition write FVerticalPosition default DefaultVerticalPosition;
Published property HorizontalMargin: Integer read FHorizontalMargin write FHorizontalMargin default DefaultHorizontalMargin;
Published property VerticalMargin: Integer read FVerticalMargin write FVerticalMargin default DefaultVerticalMargin;
Published property CollectHistory: boolean read FCollectHistory write FCollectHistory default false;

Description

Fields

Public internal const DefaultMaxMessages = 4;
 
Public internal const DefaultMessagesTimeout = 5000;
 
Public internal const DefaultHorizontalPosition = hpMiddle;
 
Public internal const DefaultVerticalPosition = vpDown;
 
Public internal const DefaultHorizontalMargin = 10;
 
Public internal const DefaultVerticalMargin = 1;
 

Methods

Public constructor Create(AOwner: TComponent); override;
 
Public destructor Destroy; override;
 
Public procedure Show(const s: string); overload;

Show new message. An overloaded version that takes a single string will detect newlines in the string automatically so a message may be multi-line. The messages will be automatically broken to fit on the screen width with given font.

Public procedure Show(s: TStringList); overload;
 
Public procedure Clear;

Clear all messages.

Public procedure Update(const SecondsPassed: Single; var HandleInput: boolean); override;
 
Public procedure Render; override;
 
Public function GetExists: boolean; override;
 

Properties

Public property Color: TCastleColor read FColor write FColor;

Color used to draw messages. Default value is yellow.

Public property History: TCastleStringList read FHistory;

All the messages passed to Show, collected only if CollectHistory. May be Nil when not CollectHistory.

Public property PositionX: Integer read FPositionX write FPositionX;

Position shift, relative to position set by HorizontalPosition and VerticalPosition. TODO: we should make positioning common for all controls, using Left, Bottom, or some Autoxxx spec.

Public property PositionY: Integer read FPositionY write FPositionY;
 
Published property MaxMessages: integer read FMaxMessages write FMaxMessages default DefaultMaxMessages;

How many message lines should be visible on the screen, at maximum.

Published property Timeout: TMilisecTime read FTimeout write FTimeout default DefaultMessagesTimeout;

How long a given message should be visible on the screen, in miliseconds. Message stops being visible when this timeout passed, or when we need more space for new messages (see MaxMessages).

Published property HorizontalPosition: THorizontalPosition read FHorizontalPosition write FHorizontalPosition default DefaultHorizontalPosition;
 
Published property VerticalPosition: TVerticalPosition read FVerticalPosition write FVerticalPosition default DefaultVerticalPosition;
 
Published property HorizontalMargin: Integer read FHorizontalMargin write FHorizontalMargin default DefaultHorizontalMargin;

Margins, in pixels, from the border of the container (window or such).

Published property VerticalMargin: Integer read FVerticalMargin write FVerticalMargin default DefaultVerticalMargin;
 
Published property CollectHistory: boolean read FCollectHistory write FCollectHistory default false;

Turn this on to have all the messages you pass to Show be collected inside History string list. History is expanded by Show, it is cleared by Clear, just like the notifications on screen. However, unlike the visible messages, it has unlimited size (messages there are not removed when MaxMessages or Timeout take action), and messages inside are not broken to honour screen width.

This is useful if you want to show the player a history of messages (in case they missed the message in game).


Generated by PasDoc 0.14.0.