-
Notifications
You must be signed in to change notification settings - Fork 0
/
Menu.pas
156 lines (110 loc) · 3.98 KB
/
Menu.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
unit Menu;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.Imaging.pngimage;
function gameModeSelection : String;
type
TMenuForm = class(TForm)
Background: TImage;
singleplayerButton: TImage;
highScoreButton: TImage;
multiplayerButton: TImage;
exitButton: TImage;
procedure exitButtonClick(Sender: TObject);
procedure highScoreButtonClick(Sender: TObject);
procedure singleplayerButtonClick(Sender: TObject);
procedure multiplayerButtonClick(Sender: TObject);
procedure singleplayerButtonMouseEnter(Sender: TObject);
procedure singleplayerButtonMouseLeave(Sender: TObject);
procedure multiplayerButtonMouseEnter(Sender: TObject);
procedure multiplayerButtonMouseLeave(Sender: TObject);
procedure highScoreButtonMouseLeave(Sender: TObject);
procedure highScoreButtonMouseEnter(Sender: TObject);
procedure exitButtonMouseEnter(Sender: TObject);
procedure exitButtonMouseLeave(Sender: TObject);
private
{ Private declarations }
public
end;
var
MenuForm: TMenuForm;
gameMode : Integer;
implementation
uses Highscore, game;
{$R *.dfm}
/// pøi stisku tlaèítka Singleplayer se hlavní okno pøepne na game s módem pro jednoho hráèe
procedure TMenuForm.singleplayerButtonClick(Sender: TObject);
begin
gameMode := 1;
Application.CreateForm(TGameForm, GameForm);
GameForm.Show;
Self.Hide;
end;
/// zmìna barvy tlaèítka pøi najetí kurzoru na tlaèítko
procedure TMenuForm.singleplayerButtonMouseEnter(Sender: TObject);
begin
SingleplayerButton.Picture.LoadFromFile('obrazky\SingleplayerClickButton.png');
end;
/// zmìna barvy tlaèítka pøi vyjetí kurzoru z tlaèítka
procedure TMenuForm.singleplayerButtonMouseLeave(Sender: TObject);
begin
SingleplayerButton.Picture.LoadFromFile('obrazky\SingleplayerButton.png');
end;
/// pøi stisku tlaèítka Multiplayer se hlavní okno pøepne na game s módem pro více hráèù
procedure TMenuForm.multiplayerButtonClick(Sender: TObject);
begin
gameMode := 2;
Application.CreateForm(TGameForm, GameForm);
GameForm.Show;
Self.Hide;
end;
/// zmìna barvy tlaèítka pøi najetí kurzoru na tlaèítko
procedure TMenuForm.multiplayerButtonMouseEnter(Sender: TObject);
begin
multiplayerButton.Picture.LoadFromFile('obrazky\MultiplayerClickButton.png');
end;
/// zmìna barvy tlaèítka pøi vyjetí kurzoru z tlaèítka
procedure TMenuForm.multiplayerButtonMouseLeave(Sender: TObject);
begin
multiplayerButton.Picture.LoadFromFile('obrazky\MultiplayerButton.png');
end;
/// funkce, která vrací cestu k správnému obrázku s návodem ke høe - používá se v game.pas
function gameModeSelection : String;
begin
if gameMode = 1 then result := 'obrazky\HowToPlaySingleplayer.png'
else result := 'obrazky\HowToPlayMultiplayer.png';
end;
/// pøi stisku tlaèítka High Score se pøepne hlavní okno na okno s high score
procedure TMenuForm.highScoreButtonClick(Sender: TObject);
begin
Application.CreateForm(ThighScoreForm, highScoreForm);
highScoreForm.Show;
Self.Hide;
end;
/// zmìna barvy tlaèítka pøi najetí kurzoru na tlaèítko
procedure TMenuForm.highScoreButtonMouseEnter(Sender: TObject);
begin
highScoreButton.Picture.LoadFromFile('obrazky\HighScoreClickButton.png');
end;
/// zmìna barvy tlaèítka pøi vyjetí kurzoru z tlaèítka
procedure TMenuForm.highScoreButtonMouseLeave(Sender: TObject);
begin
highScoreButton.Picture.LoadFromFile('obrazky\HighScoreButton.png');
end;
/// pøi stisku tlaèítka Exit se celá aplikace vypne
procedure TMenuForm.exitButtonClick(Sender: TObject);
begin
Application.Terminate;
end;
/// zmìna barvy tlaèítka pøi najetí kurzoru na tlaèítko
procedure TMenuForm.exitButtonMouseEnter(Sender: TObject);
begin
ExitButton.Picture.LoadFromFile('obrazky\ExitClickButton.png');
end;
/// zmìna barvy tlaèítka pøi vyjetí kurzoru z tlaèítka
procedure TMenuForm.exitButtonMouseLeave(Sender: TObject);
begin
ExitButton.Picture.LoadFromFile('obrazky\ExitButton.png')
end;
end.