forked from dimsa/ShadowEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainUnit.pas
79 lines (63 loc) · 1.76 KB
/
mainUnit.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
unit mainUnit;
interface
uses
System.Types, System.UITypes, FMX.Forms, FMX.Objects, FMX.Controls,
System.Classes, FMX.Types,
uEasyDevice, uDemoGame;
type
TmainForm = class(TForm)
mainImage: TImage;
procedure FormCreate(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; var KeyChar: Char;
Shift: TShiftState);
procedure FormResize(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
mainForm: TmainForm;
Game: TDemoGame;
DrawSelect: Boolean;
implementation
{$R *.fmx}
procedure TmainForm.FormCreate(Sender: TObject);
begin
Game := TDemoGame.Create;
Game.Image := mainImage;
DrawSelect := False;
{$IFDEF ANDROID}
BorderStyle := TFmxFormBorderStyle.None;
{$ENDIF}
Game.Prepare;
end;
procedure TmainForm.FormKeyDown(Sender: TObject; var Key: Word;
var KeyChar: Char; Shift: TShiftState);
begin
if KeyChar = #32 then
Game.DrawFigures := not Game.DrawFigures;
if ReturnPressed(Key) then
begin
case Game.GameStatus of
gsMenu2: Game.GameStatus := gsMenu1;
gsMenu3: Game.GameStatus := gsMenu2;
gsStatistics: Game.GameStatus := gsMenu1;
gsAbout: Game.GameStatus := gsMenu1;
gsStoryMode, gsRelaxMode, gsSurvivalMode, gsGameOver, gsComix1, gsComix2, gsComix3, gsNextLevel, gsRetryLevel: Game.GameStatus := gsMenu1;
end;
end;
end;
procedure TmainForm.FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char;
Shift: TShiftState);
begin
if ReturnPressed(Key) then
Key := 0;
end;
procedure TmainForm.FormResize(Sender: TObject);
begin
Game.Resize(Round(mainImage.Width), Round(mainImage.Height));
end;
end.