2010-09-21 06:33:18 +00:00
|
|
|
unit mainform;
|
2010-09-16 11:52:47 +00:00
|
|
|
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
2010-09-21 06:33:18 +00:00
|
|
|
ComCtrls, StdCtrls, Buttons,
|
|
|
|
//
|
|
|
|
chessdrawer, chessgame, chessconfig;
|
2010-09-16 11:52:47 +00:00
|
|
|
|
|
|
|
type
|
|
|
|
|
2010-09-21 06:33:18 +00:00
|
|
|
{ TformChess }
|
2010-09-16 11:52:47 +00:00
|
|
|
|
2010-09-21 06:33:18 +00:00
|
|
|
TformChess = class(TForm)
|
2010-09-16 11:52:47 +00:00
|
|
|
BitBtn1: TBitBtn;
|
|
|
|
btnSinglePlayer: TBitBtn;
|
2010-09-21 06:33:18 +00:00
|
|
|
btnDirectComm: TBitBtn;
|
2010-09-16 11:52:47 +00:00
|
|
|
BitBtn3: TBitBtn;
|
2010-09-21 06:33:18 +00:00
|
|
|
comboStartColor: TComboBox;
|
2010-09-16 11:52:47 +00:00
|
|
|
Label1: TLabel;
|
|
|
|
Label2: TLabel;
|
|
|
|
Label3: TLabel;
|
|
|
|
Label4: TLabel;
|
2010-09-21 06:33:18 +00:00
|
|
|
Label5: TLabel;
|
|
|
|
Label6: TLabel;
|
2010-09-16 11:52:47 +00:00
|
|
|
LabeledEdit1: TLabeledEdit;
|
|
|
|
LabeledEdit2: TLabeledEdit;
|
2010-09-21 06:33:18 +00:00
|
|
|
editPlayerName: TLabeledEdit;
|
2010-09-16 11:52:47 +00:00
|
|
|
pageStart: TUNBPage;
|
|
|
|
pageConfigConnection: TUNBPage;
|
|
|
|
notebookMain: TUntabbedNotebook;
|
|
|
|
pageConnecting: TUNBPage;
|
|
|
|
ProgressBar1: TProgressBar;
|
2010-09-21 06:33:18 +00:00
|
|
|
pageGame: TUNBPage;
|
|
|
|
procedure FormCreate(Sender: TObject);
|
2010-09-16 11:52:47 +00:00
|
|
|
procedure HandleMainScreenButton(Sender: TObject);
|
|
|
|
private
|
|
|
|
{ private declarations }
|
|
|
|
public
|
|
|
|
{ public declarations }
|
|
|
|
end;
|
|
|
|
|
|
|
|
var
|
2010-09-21 06:33:18 +00:00
|
|
|
formChess: TformChess;
|
2010-09-16 11:52:47 +00:00
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
{$R *.lfm}
|
|
|
|
|
2010-09-21 06:33:18 +00:00
|
|
|
{ TformChess }
|
2010-09-16 11:52:47 +00:00
|
|
|
|
2010-09-21 06:33:18 +00:00
|
|
|
procedure TformChess.HandleMainScreenButton(Sender: TObject);
|
2010-09-16 11:52:47 +00:00
|
|
|
begin
|
|
|
|
if Sender = btnSinglePlayer then
|
|
|
|
begin
|
2010-09-22 15:45:23 +00:00
|
|
|
notebookMain.PageIndex := 3;
|
2010-09-21 06:33:18 +00:00
|
|
|
vChessGame.StartNewGame(comboStartColor.ItemIndex);
|
|
|
|
end
|
|
|
|
else if Sender = btnDirectComm then notebookMain.PageIndex := 1;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TformChess.FormCreate(Sender: TObject);
|
|
|
|
begin
|
|
|
|
// Creation of internal components
|
|
|
|
vChessDrawer := TChessDrawer.Create(Self);
|
|
|
|
vChessDrawer.Parent := pageGame;
|
2010-09-22 15:45:23 +00:00
|
|
|
vChessDrawer.Top := 50;
|
2010-09-21 06:33:18 +00:00
|
|
|
vChessDrawer.Left := 20;
|
|
|
|
vChessDrawer.Height := INT_CHESSBOARD_SIZE;
|
|
|
|
vChessDrawer.Width := INT_CHESSBOARD_SIZE;
|
|
|
|
|
|
|
|
// Loading of resources
|
|
|
|
vChessDrawer.LoadImages();
|
2010-09-16 11:52:47 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|
|
|
|
|