Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /Unit1.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 22 - (hide annotations) (download) (as text)
Sat Jul 18 22:44:20 2015 UTC (8 years, 7 months ago) by yamat0jp
File MIME type: text/x-pascal
File size: 15631 byte(s)
大きなエラーを出す点を修正

スタートしていきなり発生していました
1 yamat0jp 5 unit Unit1;
2 yamat0jp 1
3     interface
4    
5     uses
6 yamat0jp 5 System.SysUtils, System.Types, System.UITypes, System.Classes,
7     System.Variants,
8     FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Menus,
9     System.Math, FMX.Objects, FMX.StdCtrls;
10 yamat0jp 1
11     const
12     Count = 8;
13    
14     type
15 yamat0jp 14 TStoneType = (stNone, stWhite, stBlack, stError, stEffect);
16 yamat0jp 1
17 yamat0jp 14 TEffectData = record
18     X, Y: integer;
19     Left, Top: integer;
20     Stone: TStoneType;
21     end;
22    
23 yamat0jp 3 TGridData = array [0 .. Count - 1] of array [0 .. Count - 1] of TStoneType;
24 yamat0jp 1
25     TPlayer = class
26     private
27     FAuto: Boolean;
28 yamat0jp 4 FStone: TStoneType;
29 yamat0jp 1 public
30     property Auto: Boolean read FAuto write FAuto;
31 yamat0jp 4 property Stone: TStoneType read FStone write FStone;
32 yamat0jp 1 end;
33    
34     TStoneGrid = class
35     private
36     FStrings: TGridData;
37 yamat0jp 7 FBuffer: array [0 .. Count * Count - 4] of TGridData;
38 yamat0jp 1 FTurnNumber: integer;
39     FTurnIndex: integer;
40 yamat0jp 9 FActive: Boolean;
41 yamat0jp 14 List: TList;
42 yamat0jp 20 FEffectStone: TStoneType;
43 yamat0jp 15 FBool: Boolean;
44 yamat0jp 21 FTerminated: Boolean;
45 yamat0jp 14 FIndex_X: integer;
46     FIndex_Y: integer;
47 yamat0jp 1 function GetStrings(X, Y: integer): TStoneType;
48     procedure SetStrings(X, Y: integer; const Value: TStoneType);
49     procedure SetTurnNumber(const Value: integer);
50     public
51 yamat0jp 14 constructor Create;
52     destructor Destroy; override;
53 yamat0jp 1 procedure Clear;
54 yamat0jp 10 function CalScore(Stone: TStoneType; X, Y: integer): integer;
55     function CanSetStone(Stone: TStoneType; X, Y: integer; Reverse: Boolean;
56 yamat0jp 7 const Visible: Boolean = false): Boolean;
57 yamat0jp 10 function NextStone(Stone: TStoneType): TPoint;
58 yamat0jp 9 procedure Start;
59     procedure Restart;
60     procedure Pause;
61 yamat0jp 14 function ListExecute: Boolean;
62     procedure Paint(Canvas: TCanvas);
63     procedure ImageCount(X, Y: integer);
64 yamat0jp 3 property Strings[X, Y: integer]: TStoneType read GetStrings
65     write SetStrings; default;
66 yamat0jp 1 property TurnNumber: integer read FTurnNumber write SetTurnNumber;
67 yamat0jp 10 property Active: Boolean read FActive;
68 yamat0jp 1 end;
69    
70     TForm1 = class(TForm)
71     Timer1: TTimer;
72     MainMenu1: TMainMenu;
73 yamat0jp 5 MenuItem1: TMenuItem;
74     MenuItem2: TMenuItem;
75     MenuItem3: TMenuItem;
76     MenuItem4: TMenuItem;
77     MenuItem5: TMenuItem;
78     MenuItem6: TMenuItem;
79     MenuItem7: TMenuItem;
80     PaintBox1: TPaintBox;
81 yamat0jp 7 MenuItem8: TMenuItem;
82     MenuItem9: TMenuItem;
83     MenuItem10: TMenuItem;
84     MenuItem11: TMenuItem;
85     MenuItem12: TMenuItem;
86 yamat0jp 14 Timer2: TTimer;
87     Image1: TImage;
88     Image2: TImage;
89     Image3: TImage;
90     Image4: TImage;
91 yamat0jp 15 Image5: TImage;
92 yamat0jp 1 procedure FormCreate(Sender: TObject);
93     procedure FormDestroy(Sender: TObject);
94     procedure Timer1Timer(Sender: TObject);
95     procedure FormResize(Sender: TObject);
96 yamat0jp 5 procedure MenuItem4Click(Sender: TObject);
97     procedure MenuItem2Click(Sender: TObject);
98 yamat0jp 7 procedure PaintBox1Tap(Sender: TObject; const Point: TPointF);
99     procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
100 yamat0jp 5 Shift: TShiftState; X, Y: Single);
101     procedure PaintBox1Paint(Sender: TObject; Canvas: TCanvas);
102     procedure MenuItem6Click(Sender: TObject);
103 yamat0jp 7 procedure PaintBox1Resize(Sender: TObject);
104     procedure MenuItem8Click(Sender: TObject);
105     procedure MenuItem10Click(Sender: TObject);
106     procedure MenuItem11Click(Sender: TObject);
107 yamat0jp 14 procedure Timer2Timer(Sender: TObject);
108 yamat0jp 1 private
109 yamat0jp 5 { Private ���� }
110 yamat0jp 1 StoneGrid: TStoneGrid;
111     Index: TPlayer;
112     Size: integer;
113     procedure CompStone;
114     procedure GameStart;
115     procedure ChangePlayer;
116     public
117 yamat0jp 5 { Public ���� }
118 yamat0jp 1 end;
119    
120     var
121     Player1: TPlayer;
122     Player2: TPlayer;
123    
124     Form1: TForm1;
125    
126     implementation
127    
128 yamat0jp 5 {$R *.fmx}
129 yamat0jp 7 {$R *.Windows.fmx MSWINDOWS}
130 yamat0jp 1 { TStoneGrid }
131    
132 yamat0jp 10 function TStoneGrid.CalScore(Stone: TStoneType; X, Y: integer): integer;
133 yamat0jp 1 var
134     i, j: integer;
135     begin
136 yamat0jp 10 if CanSetStone(Stone, X, Y, true) = true then
137 yamat0jp 1 begin
138 yamat0jp 20 case Stone of
139     stBlack:
140     Stone := stWhite;
141     stWhite:
142 yamat0jp 10 Stone := stBlack;
143 yamat0jp 20 stEffect:
144     Stone := FEffectStone;
145     end;
146 yamat0jp 3 result := 0;
147     for i := 0 to Count - 1 do
148     for j := 0 to Count - 1 do
149 yamat0jp 10 if CanSetStone(Stone, i, j, false) = true then
150 yamat0jp 3 inc(result);
151 yamat0jp 9 FStrings := FBuffer[FTurnIndex];
152 yamat0jp 3 end
153     else
154 yamat0jp 1 begin
155 yamat0jp 9 FStrings := FBuffer[FTurnIndex];
156 yamat0jp 3 result := -1;
157 yamat0jp 1 end;
158     end;
159    
160 yamat0jp 10 function TStoneGrid.CanSetStone(Stone: TStoneType; X, Y: integer;
161 yamat0jp 7 Reverse: Boolean; const Visible: Boolean): Boolean;
162 yamat0jp 1 var
163 yamat0jp 14 i: integer;
164 yamat0jp 4 p: Boolean;
165 yamat0jp 14 q: ^TEffectData;
166 yamat0jp 4 procedure Method(m, n: integer);
167 yamat0jp 3 var
168 yamat0jp 4 s: TStoneType;
169 yamat0jp 15 j, k: integer;
170 yamat0jp 1 begin
171 yamat0jp 4 if p = false then
172     Exit;
173     i := 1;
174 yamat0jp 3 while true do
175 yamat0jp 4 begin
176     s := GetStrings(X + m * i, Y + n * i);
177 yamat0jp 19 if s = stEffect then
178 yamat0jp 20 s:=FEffectStone;
179 yamat0jp 4 if (s = stNone) or (s = stError) then
180     break
181 yamat0jp 10 else if s = Stone then
182 yamat0jp 4 if i > 1 then
183     begin
184 yamat0jp 15 if (result = false) and (Reverse = true) then
185     SetStrings(X, Y, Stone);
186 yamat0jp 4 result := true;
187     if Reverse = true then
188 yamat0jp 1 begin
189 yamat0jp 4 for j := 1 to i - 1 do
190 yamat0jp 7 begin
191 yamat0jp 15 Form1.PaintBox1.Repaint;
192 yamat0jp 14 if Visible = true then
193     begin
194 yamat0jp 20 FEffectStone:=Stone;
195 yamat0jp 14 New(q);
196     q^.Left := X + m * j;
197     q^.Top := Y + n * j;
198     q^.Stone := Stone;
199     q^.X := 0;
200     q^.Y := 0;
201     List.Add(q);
202     SetStrings(q^.Left, q^.Top, stEffect);
203 yamat0jp 19 for k := 1 to 100 do
204 yamat0jp 15 begin
205 yamat0jp 19 Sleep(1);
206 yamat0jp 15 Application.ProcessMessages;
207     end;
208 yamat0jp 14 end
209     else
210     SetStrings(X + m * j, Y + n * j, Stone);
211 yamat0jp 7 end;
212 yamat0jp 4 break;
213 yamat0jp 3 end
214     else
215 yamat0jp 1 begin
216 yamat0jp 4 p := false;
217 yamat0jp 3 break;
218 yamat0jp 4 end;
219     end
220     else
221     break
222 yamat0jp 3 else
223 yamat0jp 4 inc(i);
224     end;
225 yamat0jp 3 end;
226    
227     begin
228 yamat0jp 17 result := false;
229 yamat0jp 15 if Visible = true then
230     begin
231     FBool := FActive;
232     FActive := false;
233     end;
234 yamat0jp 14 p := true;
235     if GetStrings(X, Y) = stNone then
236 yamat0jp 9 begin
237 yamat0jp 14 Method(-1, -1);
238     Method(-1, 0);
239     Method(-1, 1);
240     Method(0, -1);
241     Method(0, 1);
242     Method(1, -1);
243     Method(1, 0);
244     Method(1, 1);
245 yamat0jp 9 end;
246 yamat0jp 1 end;
247    
248     procedure TStoneGrid.Clear;
249     var
250     i, j: integer;
251     begin
252 yamat0jp 3 for i := 0 to Count - 1 do
253     for j := 0 to Count - 1 do
254     Strings[i, j] := stNone;
255     Strings[3, 3] := stBlack;
256     Strings[4, 4] := stBlack;
257     Strings[4, 3] := stWhite;
258     Strings[3, 4] := stWhite;
259 yamat0jp 7 FTurnNumber := 0;
260     FTurnIndex := 0;
261 yamat0jp 10 FBuffer[0] := FStrings;
262 yamat0jp 1 end;
263    
264 yamat0jp 14 constructor TStoneGrid.Create;
265     begin
266     inherited;
267     List := TList.Create;
268     end;
269    
270     destructor TStoneGrid.Destroy;
271     var
272     i: integer;
273     begin
274     for i := 0 to List.Count - 1 do
275     Dispose(List[i]);
276     List.Free;
277     inherited;
278     end;
279    
280 yamat0jp 1 function TStoneGrid.GetStrings(X, Y: integer): TStoneType;
281     begin
282 yamat0jp 3 if (X >= 0) and (X < Count) and (Y >= 0) and (Y < Count) then
283 yamat0jp 4 result := FStrings[X, Y]
284 yamat0jp 3 else
285     result := stError;
286 yamat0jp 1 end;
287    
288 yamat0jp 14 procedure TStoneGrid.ImageCount(X, Y: integer);
289     begin
290     FIndex_X := X;
291     FIndex_Y := Y;
292     end;
293    
294     function TStoneGrid.ListExecute: Boolean;
295     var
296     p: ^TEffectData;
297     i: integer;
298     begin
299     if List.Count = 0 then
300     result := false
301     else
302     begin
303     for i := 0 to List.Count - 1 do
304     begin
305     p := List.List[i];
306     if p^.X < FIndex_X - 1 then
307     p^.X := p^.X + 1
308     else if p^.Y < FIndex_Y - 1 then
309     begin
310     p^.X := 0;
311     p^.Y := p^.Y + 1;
312     end
313     else
314     begin
315     SetStrings(p^.Left, p^.Top, p^.Stone);
316     Dispose(p);
317     List[i] := nil;
318     end;
319     end;
320     for i := List.Count - 1 downto 0 do
321     if List[i] = nil then
322     List.Delete(i);
323     if List.Count = 0 then
324     begin
325 yamat0jp 21 if FTerminated = true then
326     FActive:=false
327     else
328     FActive := FBool;
329 yamat0jp 14 inc(FTurnIndex);
330     inc(FTurnNumber);
331     FBuffer[FTurnIndex] := FStrings;
332     end;
333     result := true;
334     end;
335     end;
336    
337 yamat0jp 10 function TStoneGrid.NextStone(Stone: TStoneType): TPoint;
338 yamat0jp 1 var
339     i, j, m, n: integer;
340     begin
341 yamat0jp 3 n := -1;
342     for i := 0 to Count - 1 do
343     for j := 0 to Count - 1 do
344 yamat0jp 1 begin
345 yamat0jp 10 m := CalScore(Stone, i, j);
346 yamat0jp 3 if (n = -1) or ((m > -1) and (n > m)) then
347 yamat0jp 1 begin
348 yamat0jp 3 n := m;
349     result := Point(i, j);
350 yamat0jp 1 end;
351     end;
352     if n = -1 then
353 yamat0jp 3 result := Point(-1, -1);
354 yamat0jp 1 end;
355    
356 yamat0jp 14 procedure TStoneGrid.Paint(Canvas: TCanvas);
357     var
358     i: integer;
359     k, m, n: integer;
360     s: TBitmap;
361     p: ^TEffectData;
362     begin
363     m := Form1.Image3.Bitmap.Width;
364     n := Form1.Image3.Bitmap.Height;
365 yamat0jp 15 k := Form1.Size;
366 yamat0jp 14 for i := 0 to List.Count - 1 do
367     begin
368     p := List[i];
369     if p^.Stone = stBlack then
370     s := Form1.Image1.Bitmap
371     else
372     s := Form1.Image2.Bitmap;
373     Canvas.DrawBitmap(s, RectF(p^.X * m, p^.Y * n, (p^.X + 1) * m,
374     (p^.Y + 1) * n), RectF(p^.Left * k, p^.Top * k, (p^.Left + 1) * k,
375     (p^.Top + 1) * k), 1);
376     end;
377     end;
378    
379 yamat0jp 9 procedure TStoneGrid.Pause;
380     begin
381 yamat0jp 21 FTerminated:=true;
382 yamat0jp 9 end;
383    
384     procedure TStoneGrid.Restart;
385     begin
386 yamat0jp 21 if FTerminated = true then
387     begin
388     FActive := true;
389     FTurnIndex := FTurnNumber;
390     FTerminated:=false;
391     end;
392 yamat0jp 9 end;
393    
394 yamat0jp 1 procedure TStoneGrid.SetStrings(X, Y: integer; const Value: TStoneType);
395     begin
396 yamat0jp 3 if (X >= 0) and (X < Count) and (Y >= 0) and (Y < Count) then
397     FStrings[X, Y] := Value;
398 yamat0jp 1 end;
399    
400     procedure TStoneGrid.SetTurnNumber(const Value: integer);
401     begin
402     if Value > FTurnIndex then
403 yamat0jp 4 FTurnNumber := FTurnIndex
404 yamat0jp 12 else if Value < 0 then
405     FTurnNumber := 0
406 yamat0jp 3 else
407     FTurnNumber := Value;
408     FStrings := FBuffer[FTurnNumber];
409 yamat0jp 1 end;
410    
411 yamat0jp 9 procedure TStoneGrid.Start;
412     begin
413 yamat0jp 22 FActive:=false;
414 yamat0jp 9 Clear;
415 yamat0jp 21 FTerminated:=false;
416 yamat0jp 9 FActive := true;
417     end;
418    
419 yamat0jp 1 { TForm1 }
420    
421     procedure TForm1.ChangePlayer;
422     var
423     i, j, m, n: integer;
424     s: string;
425     procedure Main;
426     begin
427     if Index = Player1 then
428 yamat0jp 17 begin
429     Index := Player2;
430     s := '������������';
431     end
432 yamat0jp 3 else
433 yamat0jp 17 begin
434 yamat0jp 3 Index := Player1;
435 yamat0jp 17 s := '������������';
436     end;
437 yamat0jp 1 end;
438     function Execute: Boolean;
439     var
440     i, j: integer;
441 yamat0jp 17 m: integer;
442     n: integer;
443 yamat0jp 1 begin
444 yamat0jp 18 for i := 0 to Count - 1 do
445     for j := 0 to Count - 1 do
446     if StoneGrid.CanSetStone(Index.Stone, i, j, false) = true then
447     begin
448     result := true;
449     Exit;
450     end;
451 yamat0jp 3 result := false;
452 yamat0jp 1 end;
453 yamat0jp 3
454 yamat0jp 1 begin
455 yamat0jp 3 Main;
456 yamat0jp 1 if Execute = false then
457     begin
458 yamat0jp 3 Main;
459 yamat0jp 1 if Execute = false then
460     begin
461 yamat0jp 9 StoneGrid.Pause;
462 yamat0jp 3 m := 0;
463     n := 0;
464     for i := 0 to Count - 1 do
465     for j := 0 to Count - 1 do
466     case StoneGrid[i, j] of
467     stBlack:
468     inc(m);
469     stWhite:
470     inc(n);
471 yamat0jp 1 end;
472 yamat0jp 17 Caption := s;
473 yamat0jp 1 if m > n then
474 yamat0jp 4 s := 'Player1 Win:' + #13#10
475 yamat0jp 3 else if m < n then
476 yamat0jp 4 s := 'Player2 Win:' + #13#10
477 yamat0jp 3 else
478     s := 'Draw:' + #13#10;
479 yamat0jp 7 Showmessage(s + '(Player1) ' + IntToStr(m) + #13#10 + '(Player2) ' +
480     IntToStr(n));
481 yamat0jp 17 end
482     else
483     Caption := s;
484     end
485     else
486     Caption := s;
487 yamat0jp 1 end;
488    
489     procedure TForm1.CompStone;
490     var
491     s: TPoint;
492     begin
493 yamat0jp 10 s := StoneGrid.NextStone(Index.Stone);
494     StoneGrid.CanSetStone(Index.Stone, s.X, s.Y, true, true);
495 yamat0jp 5 PaintBox1.Repaint;
496 yamat0jp 7 ChangePlayer;
497 yamat0jp 1 end;
498    
499     procedure TForm1.GameStart;
500     begin
501 yamat0jp 21 Index := Player1;
502 yamat0jp 9 StoneGrid.Start;
503 yamat0jp 5 PaintBox1.Repaint;
504 yamat0jp 17 Caption := '�������n������';
505 yamat0jp 1 end;
506    
507 yamat0jp 7 procedure TForm1.MenuItem10Click(Sender: TObject);
508     begin
509 yamat0jp 9 StoneGrid.Restart;
510 yamat0jp 7 end;
511    
512     procedure TForm1.MenuItem11Click(Sender: TObject);
513 yamat0jp 17 var
514     i: integer;
515 yamat0jp 7 begin
516     with StoneGrid do
517 yamat0jp 17 begin
518     i := TurnNumber;
519 yamat0jp 7 if Sender = MenuItem11 then
520     TurnNumber := TurnNumber + 1
521     else
522     TurnNumber := TurnNumber - 1;
523 yamat0jp 17 if (i = TurnNumber) then
524     Exit
525     else
526     Pause;
527     end;
528 yamat0jp 14 PaintBox1.Repaint;
529 yamat0jp 12 ChangePlayer;
530 yamat0jp 7 end;
531    
532 yamat0jp 5 procedure TForm1.MenuItem2Click(Sender: TObject);
533 yamat0jp 1 begin
534 yamat0jp 3 GameStart;
535 yamat0jp 1 end;
536    
537 yamat0jp 5 procedure TForm1.MenuItem4Click(Sender: TObject);
538 yamat0jp 1 begin
539 yamat0jp 5 Close;
540 yamat0jp 1 end;
541    
542 yamat0jp 5 procedure TForm1.MenuItem6Click(Sender: TObject);
543     begin
544 yamat0jp 7 Player1.Auto := MenuItem6.IsChecked;
545     Player2.Auto := MenuItem7.IsChecked;
546 yamat0jp 5 end;
547    
548 yamat0jp 7 procedure TForm1.MenuItem8Click(Sender: TObject);
549     begin
550 yamat0jp 9 StoneGrid.Pause;
551 yamat0jp 7 end;
552    
553 yamat0jp 5 procedure TForm1.PaintBox1Paint(Sender: TObject; Canvas: TCanvas);
554 yamat0jp 1 var
555     i, j: integer;
556     begin
557 yamat0jp 18 if StoneGrid.Active = false then
558     StoneGrid.Paint(Canvas);
559 yamat0jp 17 for i := 0 to Count - 1 do
560 yamat0jp 1 begin
561 yamat0jp 17 for j := 0 to Count - 1 do
562 yamat0jp 1 begin
563 yamat0jp 3 case StoneGrid.Strings[i, j] of
564     stWhite:
565 yamat0jp 14 Canvas.DrawBitmap(Image4.Bitmap, RectF(0, 0, Image4.Bitmap.Width,
566     Image4.Bitmap.Height), RectF(i * Size, j * Size, (i + 1) * Size,
567 yamat0jp 7 (j + 1) * Size), 1);
568 yamat0jp 3 stBlack:
569 yamat0jp 14 Canvas.DrawBitmap(Image3.Bitmap, RectF(0, 0, Image3.Bitmap.Width,
570     Image3.Bitmap.Height), RectF(i * Size, j * Size, (i + 1) * Size,
571     (j + 1) * Size), 1);
572 yamat0jp 15 stEffect:
573     continue;
574 yamat0jp 14 else
575 yamat0jp 15 Canvas.DrawBitmap(Image5.Bitmap, RectF(0, 0, Image5.Bitmap.Width,
576     Image5.Bitmap.Height), RectF(i * Size, j * Size, (i + 1) * Size,
577     (j + 1) * Size), 1);
578 yamat0jp 1 end;
579 yamat0jp 15 Canvas.DrawLine(PointF(0, j * Size), PointF(Count * Size, j * Size), 1);
580 yamat0jp 1 end;
581 yamat0jp 15 Canvas.DrawLine(PointF(i * Size, 0), PointF(i * Size, Size * Count), 1);
582 yamat0jp 1 end;
583 yamat0jp 17 Canvas.DrawLine(PointF(Count * Size, 0),
584     PointF(Count * Size, Count * Size), 1);
585     Canvas.DrawLine(PointF(0, Count * Size),
586     PointF(Count * Size, Count * Size), 1);
587 yamat0jp 1 end;
588    
589 yamat0jp 7 procedure TForm1.PaintBox1Resize(Sender: TObject);
590     begin
591     Size := Min(ClientWidth, ClientHeight) div Count;
592     end;
593    
594 yamat0jp 5 procedure TForm1.FormCreate(Sender: TObject);
595 yamat0jp 1 begin
596 yamat0jp 5 StoneGrid := TStoneGrid.Create;
597 yamat0jp 14 StoneGrid.ImageCount(Form1.Image1.Bitmap.Width div Form1.Image3.Bitmap.Width,
598     Form1.Image1.Bitmap.Height div Form1.Image3.Bitmap.Height);
599 yamat0jp 5 Player1 := TPlayer.Create;
600     Player2 := TPlayer.Create;
601     Player1.Stone := stBlack;
602     Player2.Stone := stWhite;
603     Player2.Auto := true;
604     with PaintBox1.Canvas do
605 yamat0jp 1 begin
606 yamat0jp 5 StrokeDash := TStrokeDash.Solid;
607     Stroke.Color := TAlphaColors.Black;
608     StrokeThickness := 3;
609 yamat0jp 1 end;
610 yamat0jp 7 PaintBox1Resize(Sender);
611 yamat0jp 5 GameStart;
612 yamat0jp 1 end;
613    
614 yamat0jp 5 procedure TForm1.FormDestroy(Sender: TObject);
615     begin
616     StoneGrid.Free;
617     Player1.Free;
618     Player2.Free;
619     end;
620    
621 yamat0jp 7 procedure TForm1.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
622 yamat0jp 5 Shift: TShiftState; X, Y: Single);
623     begin
624 yamat0jp 7 PaintBox1Tap(Sender, PointF(X, Y));
625 yamat0jp 5 end;
626    
627 yamat0jp 1 procedure TForm1.Timer1Timer(Sender: TObject);
628     begin
629 yamat0jp 10 if (StoneGrid.Active = true) and (Index.Auto = true) then
630 yamat0jp 3 CompStone;
631 yamat0jp 1 end;
632    
633 yamat0jp 14 procedure TForm1.Timer2Timer(Sender: TObject);
634     begin
635 yamat0jp 21 if (StoneGrid.Active = false)and(StoneGrid.ListExecute = true) then
636 yamat0jp 14 PaintBox1.Repaint;
637     end;
638    
639 yamat0jp 1 procedure TForm1.FormResize(Sender: TObject);
640     begin
641 yamat0jp 3 Size := Min(ClientWidth, ClientHeight) div Count;
642 yamat0jp 5 PaintTo(Canvas);
643 yamat0jp 1 end;
644    
645 yamat0jp 7 procedure TForm1.PaintBox1Tap(Sender: TObject; const Point: TPointF);
646 yamat0jp 1 begin
647 yamat0jp 11 if Index.Auto = false then
648     begin
649 yamat0jp 10 MenuItem10Click(Sender);
650     if StoneGrid.CanSetStone(Index.Stone, Floor(Point.X / Size),
651 yamat0jp 7 Floor(Point.Y / Size), true, true) = true then
652 yamat0jp 5 begin
653     PaintBox1.Repaint;
654 yamat0jp 7 ChangePlayer;
655 yamat0jp 5 end;
656     end;
657 yamat0jp 1 end;
658    
659     end.

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26