You can just create an instance of this class,
and add it to the
as you do with any other UI control.
But you can also use the global
Notifications instance already created
for you in the CastleGameNotifications unit (just add it to
Window.Controls list). Some engine components already make
notifications to it, and it is also automatically set up to cooperate
with the CastleScript writeln() function, so you can print to it from VRML/X3D scripts.
uses CastleWindow, CastleGameNotifications, CastleColors, CastleUIControls; var Window: TCastleWindow; begin Window := TCastleWindow.Create(Application); Window.Open; Notifications.TextAlignment := hpMiddle; Notifications.Anchor(hpMiddle); Notifications.Anchor(vpBottom, 10); Notifications.Color := Yellow; Window.Controls.InsertFront(Notifications); Notifications.Show('You picked 10 ammo!'); Application.Run; end.
Remember that you're not forced to use the global
CastleGameNotifications, especially if you don't like the
default notifications. You may always create
using only the