Castle Game Engine: CastleNotifications: Class TCastleNotifications

# Class TCastleNotifications
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleNotifications ## 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 TComponent TInputListener TUIControl TCastleNotifications ## Overview ### Fields
| `internal const DefaultMaxMessages = 4;`
| `internal const DefaultMessagesTimeout = 5000;`
| `internal const DefaultHorizontalPosition = hpMiddle;`
| `internal const DefaultVerticalPosition = vpDown;`
| `internal const DefaultHorizontalMargin = 10;`
| `internal const DefaultVerticalMargin = 1;`
### Methods
| `constructor Create(AOwner: TComponent); override;`
| `destructor Destroy; override;`
| `procedure Show(const s: string); overload;`
| `procedure Show(s: TStringList); overload;`
| `procedure Clear;`
| `procedure Update(const SecondsPassed: Single; var HandleInput: boolean); override;`
| `procedure Draw; override;`
| `function DrawStyle: TUIControlDrawStyle; override;`
### Properties
| `property Color: TVector3Single read FColor write FColor;`
| `property History: TCastleStringList read FHistory;`
| `property MaxMessages: integer read FMaxMessages write FMaxMessages default DefaultMaxMessages;`
| `property Timeout: TMilisecTime read FTimeout write FTimeout default DefaultMessagesTimeout;`
| `property HorizontalPosition: THorizontalPosition read FHorizontalPosition write FHorizontalPosition default DefaultHorizontalPosition;`
| `property VerticalPosition: TVerticalPosition read FVerticalPosition write FVerticalPosition default DefaultVerticalPosition;`
| `property HorizontalMargin: Integer read FHorizontalMargin write FHorizontalMargin default DefaultHorizontalMargin;`
| `property VerticalMargin: Integer read FVerticalMargin write FVerticalMargin default DefaultVerticalMargin;`
| `property CollectHistory: boolean read FCollectHistory write FCollectHistory default false;`
## Description ### Fields
| `internal const DefaultMaxMessages = 4;`
| `internal const DefaultMessagesTimeout = 5000;`
| `internal const DefaultHorizontalPosition = hpMiddle;`
| `internal const DefaultVerticalPosition = vpDown;`
| `internal const DefaultHorizontalMargin = 10;`
| `internal const DefaultVerticalMargin = 1;`
### Methods
| `constructor Create(AOwner: TComponent); override;`
| `destructor Destroy; override;`
| `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.
| `procedure Show(s: TStringList); overload;`
| `procedure Clear;`
Clear all messages.
| `procedure Update(const SecondsPassed: Single; var HandleInput: boolean); override;`
| `procedure Draw; override;`
| `function DrawStyle: TUIControlDrawStyle; override;`
### Properties
| `property Color: TVector3Single read FColor write FColor;`
Color used to draw messages. Default value is yellow.
| `property History: TCastleStringList read FHistory;`
All the messages passed to Show, collected only if CollectHistory. May be `Nil` when not CollectHistory.
| `property MaxMessages: integer read FMaxMessages write FMaxMessages default DefaultMaxMessages;`
How many message lines should be visible on the screen, at maximum.
| `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).
| `property HorizontalPosition: THorizontalPosition read FHorizontalPosition write FHorizontalPosition default DefaultHorizontalPosition;`
| `property VerticalPosition: TVerticalPosition read FVerticalPosition write FVerticalPosition default DefaultVerticalPosition;`
| `property HorizontalMargin: Integer read FHorizontalMargin write FHorizontalMargin default DefaultHorizontalMargin;`
Margins, in pixels, from the border of the container (window or such).
| `property VerticalMargin: Integer read FVerticalMargin write FVerticalMargin default DefaultVerticalMargin;`
| `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.13.0 on 2013-08-17 21:27:13