-
Notifications
You must be signed in to change notification settings - Fork 5
/
unit6.pas
167 lines (148 loc) · 4.12 KB
/
unit6.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
157
158
159
160
161
162
163
164
165
166
(******************************************************************************)
(* *)
(* Author : Uwe Schächterle (Corpsman) *)
(* *)
(* This file is part of Clickomania *)
(* *)
(* See the file license.md, located under: *)
(* https://github.com/PascalCorpsman/Software_Licenses/blob/main/license.md *)
(* for details about the license. *)
(* *)
(* It is not allowed to change or remove this text from any *)
(* source file of the project. *)
(* *)
(******************************************************************************)
Unit Unit6;
{$MODE objfpc}
Interface
Uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, uclickomania;
Type
{ TForm6 }
TForm6 = Class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
ColorDialog1: TColorDialog;
Label1: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Panel1: TPanel;
Panel10: TPanel;
Panel11: TPanel;
Panel12: TPanel;
Panel13: TPanel;
Panel14: TPanel;
Panel15: TPanel;
Panel16: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
Panel5: TPanel;
Panel6: TPanel;
Panel7: TPanel;
Panel8: TPanel;
Panel9: TPanel;
Procedure Button1Click(Sender: TObject);
Procedure Button2Click(Sender: TObject);
Procedure Button3Click(Sender: TObject);
Procedure FormCreate(Sender: TObject);
Procedure FormPaint(Sender: TObject);
Procedure Panel2Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
End;
Var
Form6: TForm6;
cls: Array[0..high(StoneColors)] Of TColor;
clss: Array[0..high(StoneColors)] Of TColor;
Implementation
{$R *.lfm}
{$I clickomania.inc}
{ TForm6 }
Procedure TForm6.FormCreate(Sender: TObject);
Var
l: Tlabel;
p: TPanel;
i: integer;
Begin
panel1.Caption := '';
For i := 1 To 15 Do Begin
l := Tlabel(FindComponent('Label' + inttostr(i)));
l.Caption := 'Stone ' + inttostr(i);
p := Tpanel(findcomponent('Panel' + inttostr(i + 1)));
p.caption := '';
End;
label9.caption := 'Stone 9';
Caption := 'Select color';
Constraints.MinHeight := height;
Constraints.MaxHeight := height;
Constraints.MinWidth := width;
Constraints.MaxWidth := width;
End;
Procedure TForm6.Button3Click(Sender: TObject);
Begin
close;
End;
Procedure TForm6.Button1Click(Sender: TObject);
Var
i: Integer;
Begin
For i := 0 To high(StoneColors) Do Begin
clss[i] := TRGBToColor(StoneColorsDef[i])
End;
If assigned(sender) Then
FormPaint(Nil);
End;
Procedure TForm6.Button2Click(Sender: TObject);
Var
i: Integer;
Begin
For i := 0 To High(StoneColors) Do
cls[i] := clss[i];
If Assigned(sender) Then
close;
End;
Procedure TForm6.FormPaint(Sender: TObject);
Var
i: Integer;
p: Tpanel;
Begin
For i := 2 To 16 Do Begin
p := Tpanel(FindComponent('Panel' + inttostr(i)));
p.Canvas.brush.color := clss[i - 2];
p.Canvas.Pen.color := clblack;
p.canvas.Rectangle(3, 3, 22, 17);
End;
End;
Procedure TForm6.Panel2Click(Sender: TObject);
Var
p: TPanel;
s: String;
i: Integer;
Begin
p := Tpanel(sender);
s := p.name;
i := strtoint(copy(s, length('PanelX'), length(s)));
ColorDialog1.Color := clss[i - 2];
If ColorDialog1.execute Then Begin
clss[i - 2] := ColorDialog1.Color;
End;
FormPaint(Nil);
End;
End.