Debian Codegraph @

examples/platformer/code/gameviewgameover.pas

raw
1 {
2 Copyright 2021-2021 Andrzej Kilijański, 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 { View when game is over (player died or cancelled). }
17 unit GameViewGameOver;
18
19 interface
20
21 uses Classes,
22 CastleUIControls, CastleControls;
23
24 type
25 TViewGameOver = class(TCastleView)
26 published
27 { Components designed using CGE editor.
28 These fields will be automatically initialized at Start. }
29 ButtonMenu: TCastleButton;
30 private
31 procedure ClickMenu(Sender: TObject);
32 public
33 constructor Create(AOwner: TComponent); override;
34 procedure Start; override;
35
36 end;
37
38 var
39 ViewGameOver: TViewGameOver;
40
41 implementation
42
43 uses CastleSoundEngine,
44 GameSound, GameViewMenu;
45
46 constructor TViewGameOver.Create(AOwner: TComponent);
47 begin
48 inherited;
49 DesignUrl := 'castle-data:/gameviewgameover.castle-user-interface';
50 end;
51
52 procedure TViewGameOver.ClickMenu(Sender: TObject);
53 begin
54 Container.View := ViewMenu;
55 end;
56
57 procedure TViewGameOver.Start;
58 begin
59 inherited;
60 ButtonMenu.OnClick := {$ifdef FPC}@{$endif}ClickMenu;
61
62 { Play menu music }
63 SoundEngine.LoopingChannel[0].Sound := NamedSound('MenuMusic');
64 end;
65
66 end.