Debian Codegraph @

examples/tiled/strategy_game_demo/code/gameviewinstructions.pas

raw
1 {
2 Copyright 2018-2022 Michalis Kamburelis.
3
4 This file is part of "Castle Game Engine".
5
6 "Castle Game Engine" is free software; see the file COPYING.txt,
7 included in this distribution, for details about the copyright.
8
9 "Castle Game Engine" is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 ----------------------------------------------------------------------------
14 }
15
16 { Display instructions. }
17 unit GameViewInstructions;
18
19 interface
20
21 uses Classes,
22 CastleControls, CastleWindow, CastleUIControls;
23
24 type
25 TViewInstructions = class(TCastleView)
26 published
27 { Components designed using CGE editor.
28 These fields will be automatically initialized at Start. }
29 ButtonClose: TCastleButton;
30 strict private
31 procedure ClickClose(Sender: TObject);
32 public
33 constructor Create(AOwner: TComponent); override;
34 procedure Start; override;
35 end;
36
37 var
38 ViewInstructions: TViewInstructions;
39
40 implementation
41
42 uses SysUtils,
43 CastleComponentSerialize,
44 GameViewPlay;
45
46 constructor TViewInstructions.Create(AOwner: TComponent);
47 begin
48 inherited;
49 DesignUrl := 'castle-data:/gameviewinstructions.castle-user-interface';
50 end;
51
52 procedure TViewInstructions.Start;
53 begin
54 inherited;
55
56 ButtonClose.OnClick := {$ifdef FPC}@{$endif}ClickClose;
57
58 { do not pass clicks to view underneath }
59 InterceptInput := true;
60 end;
61
62 procedure TViewInstructions.ClickClose(Sender: TObject);
63 begin
64 Container.PopView(Self);
65 end;
66
67 end.