-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMain.pas
95 lines (83 loc) · 2.74 KB
/
Main.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
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, XPMan, SudokuGameEngine, ExtCtrls, StdCtrls;
type
TFormMain = class(TForm)
XPManifest: TXPManifest;
procedure FormCreate(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormMain: TFormMain;
SGE:TGameByHemulGM;
implementation
{$R *.dfm}
procedure TFormMain.FormCreate(Sender: TObject);
begin
Color:=clBlack;
try
SGE:=TSudokuGame.Create(Canvas);
except
Ahtung;
end;
TSudokuGame(SGE).CreateField(35);
end;
procedure TFormMain.FormKeyPress(Sender: TObject; var Key: Char);
begin
if TSudokuGame(SGE).Edit then
case Key of
'1'..'9':with TSudokuGame(SGE) do
if not GraphicEngine.QuestKey then Field[SelectedCell.Y, SelectedCell.X].SetFull(StrToInt(Key))
else Field[SelectedCell.Y, SelectedCell.X].SetQuest(StrToInt(Key));
Char(8):with TSudokuGame(SGE) do
begin
Field[SelectedCell.Y, SelectedCell.X].Delete;
GraphicEngine.ShowKeyboard:=False;
end;
' ':with TSudokuGame(SGE) do GraphicEngine.QuestKey:=not GraphicEngine.QuestKey;
Char(27):with TSudokuGame(SGE) do Edit:=False;
end
else
case Key of
'1'..'9':with TSudokuGame(SGE) do CreateField(StrToInt(Key) * 10);
' ':TSudokuGame(SGE).CreateField(TSudokuGame(SGE).Difficult);
#13:TSudokuGame(SGE).ShowCheckInfo;
'C', 'c', 'ñ', 'Ñ':TSudokuGame(SGE).Clear;
'F', 'À', 'f', 'à':TSudokuGame(SGE).Fill_v1;
'D', 'Â', 'd', 'â':TSudokuGame(SGE).Fill_v2;
'G', 'Ï', 'g', 'ï':TSudokuGame(SGE).Fill_v3;
Char(27):if ClientHeight <= 380 then ClientHeight:=455 else ClientHeight:=380;
'Q', 'q', 'é', 'É':TSudokuGame(SGE).Processing:=False;
'Z', 'z', 'ÿ', 'ß':TSudokuGame(SGE).Fix;
Char(8):TSudokuGame(SGE).ClearFull;
end;
//ShowMessage(IntToStr(Ord(Key)));
end;
procedure TFormMain.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
TSudokuGame(SGE).MouseUp(Button, Shift, X, Y);
end;
procedure TFormMain.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
TSudokuGame(SGE).MouseMove(Shift, X, Y);
end;
procedure TFormMain.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
TSudokuGame(SGE).MouseDown(Button, Shift, X, Y);
end;
end.