-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUMain.~pas
107 lines (81 loc) · 2.25 KB
/
UMain.~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
unit UMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,UBoard, ExtCtrls, StdCtrls, Tilebmp, jpeg;
type
TFormMain = class(TForm)
Memo1: TMemo;
Image: TImage;
ShapeMain: TShape;
Tiles: TTileBmp;
ShapeFade: TShape;
MainImage: TImage;
OptionsImage: TImage;
procedure FormCreate(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Memo1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormShow(Sender: TObject);
private
protected
{ Private declarations }
public
Board:TBoard;
ThemeIndex:Integer;
{ Public declarations }
end;
var
FormMain: TFormMain;
implementation
{$R *.dfm}
procedure TFormMain.FormCreate(Sender: TObject);
var
R:TRect;
begin
DoubleBuffered:=True;
Board:= TBoard.Create(self);
Board.Parent:= Self;
Width:= Screen.Width;
Height:= Screen.Height;
BorderStyle:= bsNone;
WindowState:= wsMaximized;
Board.Left:= (Screen.Width div 2) - (Board.Width div 2);
Board.Top:= (Screen.Height div 2) - (Board.Height div 2) + (Board.Height div 16) ;
ShapeMain.Width:= Board.Width + ShapeMain.Pen.Width*2;
ShapeMain.Height:=Board.Height + ShapeMain.Pen.Width*2;
ShapeMain.Top:= Board.Top - ShapeMain.Pen.Width;
ShapeMain.Left:= Board.Left - ShapeMain.Pen.Width;
Tiles.Width:= Screen.Width;
Tiles.Height:= Screen.Height;
Tiles.Left:=0;
Tiles.Top:= 0;
ShapeFade.Left:= ShapeMain.Left+5;
ShapeFade.Top:= ShapeMain.Top+5;
ShapeFade.Width:= ShapeMain.Width;
ShapeFade.Height:= ShapeMain.Height;
MainImage.Top:= 0;
MainImage.Left:= (Screen.Width div 2) - (MainImage.Width div 2);
ThemeIndex:= 0;
end;
procedure TFormMain.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
case Key of
49:ThemeIndex:=0;
50:ThemeIndex:=1;
51:ThemeIndex:=2;
end;
Board.MyKeyDown(Sender,Key,Shift);
end;
procedure TFormMain.Memo1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
OnKeyDown(Sender,Key,Shift);
end;
procedure TFormMain.FormShow(Sender: TObject);
begin
Board.StartGame;
end;
end.