Debian Codegraph @

examples/instantfpc/castle_open_dialog

raw
1 #!/usr/bin/env instantfpc
2
3 {
4 Copyright 2020-2022 Michalis Kamburelis.
5
6 This file is part of "Castle Game Engine".
7
8 "Castle Game Engine" is free software; see the file COPYING.txt,
9 included in this distribution, for details about the copyright.
10
11 "Castle Game Engine" is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
15 ----------------------------------------------------------------------------
16 }
17
18 { Show the 1st command-line parameter in a CGE window.
19
20 To make this work,
21 - install FPC, which should include the instantfpc binary
22 - install CGE using FpMake/FpPkg following https://castle-engine.io/fpmake
23
24 Then run like
25 ./castle_open_dialog
26 ./castle_open_dialog 'Hello!!'
27 }
28
29 uses CastleParameters, CastleWindow, CastleControls, CastleColors, CastleUIControls,
30 CastleUtils;
31
32 var
33 DisplayCaption: String = 'Hello world' + NL + 'from Castle Game Engine' + NL + 'run through instantfpc';
34 Window: TCastleWindow;
35 L: TCastleLabel;
36 begin
37 if Parameters.High >= 1 then
38 DisplayCaption := Parameters[1];
39
40 Window := TCastleWindow.Create(Application);
41 Window.Open;
42
43 L := TCastleLabel.Create(Application);
44 L.FontSize := 40;
45 L.Color := White;
46 L.Anchor(vpMiddle);
47 L.Anchor(hpMiddle);
48 L.Caption := DisplayCaption;
49 L.Alignment := hpMiddle;
50 Window.Controls.InsertFront(L);
51
52 Application.Run;
53 end.