-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChess.cpp
45 lines (39 loc) · 1.11 KB
/
Chess.cpp
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
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Chess.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
void Init_Game();
TFrm *Frm;
//---------------------------------------------------------------------------
__fastcall TFrm::TFrm(TComponent* Owner)
: TForm(Owner)
{
Init_Game();
}
//---------------------------------------------------------------------------
void __fastcall TFrm::BtnCloseClick(TObject *Sender)
{
Frm->Close();
}
//---------------------------------------------------------------------------
void __fastcall TFrm::BgpButtonClicked(TObject *Sender, int Index)
{
if ( ps[Index-1].Clicked == 0 || ps[Index-1].Clicked == 2 )
{
Bgp->Items->Items[Index]->ImageIndex = 0; // 0 is black
ps[Index-1].Clicked = 1;
}
else if (ps[Index-1].Clicked = 1)
{
Bgp->Items->Items[Index]->ImageIndex = 1;
ps[Index-1].Clicked = 2;
}
}
//---------------------------------------------------------------------------
void Init_Game()
{
Frm->ps = new Pcs[144];
}