Advances fpchess up to being able to draw the board and tiles, and adds the tile images.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1324 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2010-09-22 15:45:23 +00:00
parent 2bd91fb276
commit 6a3bf19703
18 changed files with 248 additions and 128 deletions

View File

@@ -5,8 +5,8 @@ unit chessdrawer;
interface interface
uses uses
Classes, SysUtils, Controls, Graphics, LCLType, Classes, SysUtils, Controls, Graphics, LCLType, IntfGraphics, fpimage,
// Math,
chessgame, chessconfig; chessgame, chessconfig;
type type
@@ -15,17 +15,21 @@ type
TChessDrawer = class(TCustomControl) TChessDrawer = class(TCustomControl)
private private
imgBoard, imgBoard, imgWPawn, imgWKnight, imgWBishop, imgWRook, imgWQueen,
imgWPawn, imgWKnight, imgWBishop, imgWRook, imgWQueen, imgWKing, imgWKing, imgBPawn, imgBKnight, imgBBishop, imgBRook, imgBQueen,
imgBPawn, imgBKnight, imgBBishop, imgBRook, imgBQueen, imgBKing: imgBKing: TPortableNetworkGraphic;
TPortableNetworkGraphic; { bmpBoard, bmpWPawn, bmpWKnight, bmpWBishop, bmpWRook, bmpWQueen,
bmpWKing, bmpBPawn, bmpBKnight, bmpBBishop, bmpBRook, bmpBQueen,
bmpBKing: TBitmap;}
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
procedure EraseBackground(DC: HDC); override; procedure EraseBackground(DC: HDC); override;
procedure Paint; override; procedure Paint; override;
procedure DrawToCanvas(ACanvas: TCanvas); procedure DrawToCanvas(ACanvas: TCanvas);
procedure DrawChessTile(ACanvas: TCanvas; ACol, ARow: Integer; procedure DrawImageWithTransparentColor(
ATile: TChessTile); ADest: TLazIntfImage; const ADestX, ADestY: Integer; AColor: TFPColor;
AImage: TFPImageBitmap);
function GetChessTileImage(ATile: TChessTile): TPortableNetworkGraphic;
procedure LoadImages(); procedure LoadImages();
end; end;
@@ -51,6 +55,20 @@ begin
imgBRook := TPortableNetworkGraphic.Create; imgBRook := TPortableNetworkGraphic.Create;
imgBQueen := TPortableNetworkGraphic.Create; imgBQueen := TPortableNetworkGraphic.Create;
imgBKing := TPortableNetworkGraphic.Create; imgBKing := TPortableNetworkGraphic.Create;
{ bmpBoard := TBitmap.Create;
bmpWPawn := TBitmap.Create;
bmpWKnight := TBitmap.Create;
bmpWBishop := TBitmap.Create;
bmpWRook := TBitmap.Create;
bmpWQueen := TBitmap.Create;
bmpWKing := TBitmap.Create;
bmpBPawn := TBitmap.Create;
bmpBKnight := TBitmap.Create;
bmpBBishop := TBitmap.Create;
bmpBRook := TBitmap.Create;
bmpBQueen := TBitmap.Create;
bmpBKing := TBitmap.Create; }
end; end;
procedure TChessDrawer.EraseBackground(DC: HDC); procedure TChessDrawer.EraseBackground(DC: HDC);
@@ -61,7 +79,7 @@ end;
procedure TChessDrawer.Paint; procedure TChessDrawer.Paint;
var var
x, y: Integer; x, y: integer;
Bitmap: TBitmap; Bitmap: TBitmap;
begin begin
Bitmap := TBitmap.Create; Bitmap := TBitmap.Create;
@@ -77,45 +95,96 @@ begin
Bitmap.Free; Bitmap.Free;
end; end;
// inherited Paint; // inherited Paint;
end; end;
procedure TChessDrawer.DrawToCanvas(ACanvas: TCanvas); procedure TChessDrawer.DrawToCanvas(ACanvas: TCanvas);
var var
col, row: Integer; col, row: integer;
lIntfImage: TLazIntfImage;
lTmpBmp: TBitmap;
lTileBmp: TPortableNetworkGraphic;
X, Y: integer;
begin begin
// First draw the board lIntfImage := TLazIntfImage.Create(0, 0);
ACanvas.Draw(0, 0, imgBoard); lTmpBmp := TBitmap.Create;
try
// First draw the board
lIntfImage.LoadFromBitmap(imgBoard.Handle, 0{bmpBoard.MaskHandle});
// Now all pieces // Now all pieces
for col := 1 to 8 do for col := 1 to 8 do
for row := 1 to 8 do for row := 1 to 8 do
DrawChessTile(ACanvas, col, row, vChessGame.Board[col][row]); begin
lTileBmp := GetChessTileImage(vChessGame.Board[col][row]);
if lTileBmp = nil then Continue;
X := (col - 1) * INT_CHESSTILE_SIZE;
Y := (8 - row) * INT_CHESSTILE_SIZE;
DrawImageWithTransparentColor(lIntfImage, X, Y, FPCOLOR_TRANSPARENT_TILE, lTileBmp);
end;
lTmpBmp.LoadFromIntfImage(lIntfImage);
ACanvas.Draw(0, 0, lTmpBmp);
finally
lTmpBmp.Free;
lIntfImage.Free;
end;
end; end;
procedure TChessDrawer.DrawChessTile(ACanvas: TCanvas; ACol, ARow: Integer; procedure TChessDrawer.DrawImageWithTransparentColor(ADest: TLazIntfImage;
ATile: TChessTile); const ADestX, ADestY: Integer; AColor: TFPColor; AImage: TFPImageBitmap);
var var
X, Y: Integer; x, y, CurX, CurY: Integer;
CurColor: TFPColor;
IntfImage: TLazIntfImage;
lDrawWidth, lDrawHeight: Integer;
begin begin
if ATile = ctEmpty then Exit; IntfImage := TLazIntfImage.Create(0,0);
try
IntfImage.LoadFromBitmap(AImage.Handle, AImage.MaskHandle);
X := (ACol - 1) * INT_CHESSTILE_SIZE; // Take care not to draw outside the destination area
Y := (8 - ARow) * INT_CHESSTILE_SIZE; lDrawWidth := Min(ADest.Width - ADestX, AImage.Width);
lDrawHeight := Min(ADest.Height - ADestY, AImage.Height);
for y := 0 to lDrawHeight - 1 do
begin
for x := 0 to lDrawWidth - 1 do
begin
CurX := ADestX + x;
CurY := ADestY + y;
// Never draw outside the destination
if (CurX < 0) or (CurY < 0) then Continue;
// CurColor := IntfImage.Colors[x, y]; // Just for debugging
if IntfImage.Colors[x, y].Green <> AColor.Green then
ADest.Colors[CurX, CurY] := IntfImage.Colors[x, y];
end;
end;
finally
IntfImage.Free;
end;
end;
function TChessDrawer.GetChessTileImage(ATile: TChessTile): TPortableNetworkGraphic;
begin
case ATile of case ATile of
ctWPawn: ACanvas.Draw(X, Y, imgWPawn); ctWPawn: Result := imgWPawn;
ctWKnight: ACanvas.Draw(X, Y, imgWKnight); ctWKnight: Result := imgWKnight;
ctWBishop: ACanvas.Draw(X, Y, imgWBishop); ctWBishop: Result := imgWBishop;
ctWRook: ACanvas.Draw(X, Y, imgWRook); ctWRook: Result := imgWRook;
ctWQueen: ACanvas.Draw(X, Y, imgWQueen); ctWQueen: Result := imgWQueen;
ctWKing: ACanvas.Draw(X, Y, imgWKing); ctWKing: Result := imgWKing;
ctBPawn: ACanvas.Draw(X, Y, imgBPawn); ctBPawn: Result := imgBPawn;
ctBKnight: ACanvas.Draw(X, Y, imgBKnight); ctBKnight: Result := imgBKnight;
ctBBishop: ACanvas.Draw(X, Y, imgBBishop); ctBBishop: Result := imgBBishop;
ctBRook: ACanvas.Draw(X, Y, imgBRook); ctBRook: Result := imgBRook;
ctBQueen: ACanvas.Draw(X, Y, imgBQueen); ctBQueen: Result := imgBQueen;
ctBKing: ACanvas.Draw(X, Y, imgBKing); ctBKing: Result := imgBKing;
else
Result := nil;
end; end;
end; end;
@@ -125,7 +194,7 @@ var
begin begin
lDir := vChessConfig.GetCurrentSkinDir(); lDir := vChessConfig.GetCurrentSkinDir();
imgBoard.LoadFromFile(lDir + 'board.png'); imgBoard.LoadFromFile(lDir + 'base.png');
imgWPawn.LoadFromFile(lDir + 'wpawn.png'); imgWPawn.LoadFromFile(lDir + 'wpawn.png');
imgWKnight.LoadFromFile(lDir + 'wknight.png'); imgWKnight.LoadFromFile(lDir + 'wknight.png');
imgWBishop.LoadFromFile(lDir + 'wbishop.png'); imgWBishop.LoadFromFile(lDir + 'wbishop.png');
@@ -138,6 +207,18 @@ begin
imgBRook.LoadFromFile(lDir + 'brook.png'); imgBRook.LoadFromFile(lDir + 'brook.png');
imgBQueen.LoadFromFile(lDir + 'bqueen.png'); imgBQueen.LoadFromFile(lDir + 'bqueen.png');
imgBKing.LoadFromFile(lDir + 'bking.png'); imgBKing.LoadFromFile(lDir + 'bking.png');
{ bmpWKnight.Assign(imgWKnight);
bmpWKnight.Assign(imgWBishop);
bmpWKnight.Assign(imgWRook);
bmpWKnight.Assign(imgWQueen);
bmpWKnight.Assign(imgWKing);
bmpWKnight.Assign(imgBPawn);
bmpWKnight.Assign(imgBKnight);
bmpWKnight.Assign(imgBBishop);
bmpWKnight.Assign(imgBRook);
bmpWKnight.Assign(imgBQueen);
bmpWKnight.Assign(imgBKing); }
end; end;
end. end.

View File

@@ -5,7 +5,7 @@ unit chessgame;
interface interface
uses uses
Classes, SysUtils; Classes, SysUtils, fpimage;
const const
colA = 1; colA = 1;
@@ -17,8 +17,10 @@ const
colG = 7; colG = 7;
colH = 8; colH = 8;
INT_CHESSTILE_SIZE = 20; INT_CHESSTILE_SIZE = 40;
INT_CHESSBOARD_SIZE = 200; INT_CHESSBOARD_SIZE = 40 * 8;
FPCOLOR_TRANSPARENT_TILE: TFPColor = (Red: $0000; Green: $8000; Blue: $8000; Alpha: alphaOpaque); //colTeal
type type

View File

@@ -31,12 +31,12 @@
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item1> </Item1>
</RequiredPackages> </RequiredPackages>
<Units Count="25"> <Units Count="30">
<Unit0> <Unit0>
<Filename Value="fpchess.lpr"/> <Filename Value="fpchess.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="fpchess"/> <UnitName Value="fpchess"/>
<UsageCount Value="32"/> <UsageCount Value="33"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
@@ -46,9 +46,9 @@
<UnitName Value="mainform"/> <UnitName Value="mainform"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="56"/> <TopLine Value="52"/>
<CursorPos X="45" Y="72"/> <CursorPos X="24" Y="70"/>
<UsageCount Value="32"/> <UsageCount Value="33"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
</Unit1> </Unit1>
@@ -164,9 +164,9 @@
<IsVisibleTab Value="True"/> <IsVisibleTab Value="True"/>
<EditorIndex Value="3"/> <EditorIndex Value="3"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="74"/> <TopLine Value="197"/>
<CursorPos X="3" Y="80"/> <CursorPos X="36" Y="221"/>
<UsageCount Value="30"/> <UsageCount Value="31"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit16> </Unit16>
<Unit17> <Unit17>
@@ -222,9 +222,9 @@
<UnitName Value="chessgame"/> <UnitName Value="chessgame"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="13"/> <TopLine Value="1"/>
<CursorPos X="22" Y="21"/> <CursorPos X="41" Y="23"/>
<UsageCount Value="22"/> <UsageCount Value="23"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit23> </Unit23>
<Unit24> <Unit24>
@@ -233,132 +233,177 @@
<UnitName Value="chessconfig"/> <UnitName Value="chessconfig"/>
<EditorIndex Value="2"/> <EditorIndex Value="2"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="22"/> <TopLine Value="18"/>
<CursorPos X="13" Y="39"/> <CursorPos X="13" Y="39"/>
<UsageCount Value="22"/> <UsageCount Value="23"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit24> </Unit24>
<Unit25>
<Filename Value="..\..\..\lazarussvn\lcl\graphics.pp"/>
<UnitName Value="Graphics"/>
<EditorIndex Value="6"/>
<WindowIndex Value="0"/>
<TopLine Value="217"/>
<CursorPos X="12" Y="232"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit25>
<Unit26>
<Filename Value="..\..\..\lazarussvn\lcl\intfgraphics.pas"/>
<UnitName Value="IntfGraphics"/>
<EditorIndex Value="4"/>
<WindowIndex Value="0"/>
<TopLine Value="3455"/>
<CursorPos X="1" Y="3483"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit26>
<Unit27>
<Filename Value="..\..\..\lazarus29\fpc\2.4.3\source\packages\fcl-image\src\fpimage.pp"/>
<UnitName Value="FPimage"/>
<EditorIndex Value="5"/>
<WindowIndex Value="0"/>
<TopLine Value="10"/>
<CursorPos X="25" Y="31"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit27>
<Unit28>
<Filename Value="..\..\..\fpcsvn\packages\fcl-image\src\fpcolors.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="15" Y="10"/>
<UsageCount Value="10"/>
</Unit28>
<Unit29>
<Filename Value="..\..\..\lazarussvn\lcl\interfaces\win32\win32wsbuttons.pp"/>
<UnitName Value="Win32WSButtons"/>
<WindowIndex Value="0"/>
<TopLine Value="296"/>
<CursorPos X="1" Y="313"/>
<UsageCount Value="10"/>
</Unit29>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="chessconfig.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="16" Column="38" TopLine="1"/> <Caret Line="108" Column="1" TopLine="100"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="chessdrawer.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="19" Column="28" TopLine="4"/> <Caret Line="110" Column="1" TopLine="100"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="chessgame.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="21" Column="28" TopLine="12"/> <Caret Line="113" Column="1" TopLine="100"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="chessgame.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="24" Column="28" TopLine="7"/> <Caret Line="114" Column="1" TopLine="100"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="chessgame.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="82" Column="11" TopLine="61"/> <Caret Line="116" Column="1" TopLine="100"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="chessgame.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="24" Column="62" TopLine="13"/> <Caret Line="117" Column="1" TopLine="100"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="chessgame.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="71" Column="8" TopLine="59"/> <Caret Line="119" Column="1" TopLine="100"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="mainform.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="70" Column="28" TopLine="49"/> <Caret Line="120" Column="1" TopLine="100"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="mainform.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="71" Column="28" TopLine="50"/> <Caret Line="122" Column="1" TopLine="100"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="mainform.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="70" Column="28" TopLine="49"/> <Caret Line="123" Column="1" TopLine="100"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="mainform.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="71" Column="28" TopLine="50"/> <Caret Line="110" Column="61" TopLine="94"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="mainform.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="72" Column="28" TopLine="51"/> <Caret Line="123" Column="29" TopLine="102"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="mainform.pas"/> <Filename Value="..\..\..\lazarussvn\lcl\intfgraphics.pas"/>
<Caret Line="71" Column="28" TopLine="50"/> <Caret Line="3485" Column="1" TopLine="3480"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="mainform.pas"/> <Filename Value="..\..\..\lazarussvn\lcl\intfgraphics.pas"/>
<Caret Line="70" Column="28" TopLine="49"/> <Caret Line="3488" Column="1" TopLine="3480"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="mainform.pas"/> <Filename Value="..\..\..\lazarussvn\lcl\intfgraphics.pas"/>
<Caret Line="71" Column="28" TopLine="50"/> <Caret Line="3486" Column="1" TopLine="3480"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="mainform.pas"/> <Filename Value="..\..\..\lazarussvn\lcl\intfgraphics.pas"/>
<Caret Line="72" Column="28" TopLine="51"/> <Caret Line="3485" Column="1" TopLine="3480"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="mainform.pas"/> <Filename Value="..\..\..\lazarussvn\lcl\intfgraphics.pas"/>
<Caret Line="73" Column="28" TopLine="52"/> <Caret Line="3481" Column="27" TopLine="3475"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="chessgame.pas"/> <Filename Value="..\..\..\lazarussvn\lcl\intfgraphics.pas"/>
<Caret Line="41" Column="20" TopLine="28"/> <Caret Line="3492" Column="3" TopLine="3481"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="mainform.pas"/> <Filename Value="..\..\..\lazarussvn\lcl\intfgraphics.pas"/>
<Caret Line="60" Column="53" TopLine="52"/> <Caret Line="35" Column="42" TopLine="22"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="chessgame.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="108" Column="34" TopLine="96"/> <Caret Line="28" Column="15" TopLine="21"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="chessgame.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="75" Column="9" TopLine="63"/> <Caret Line="131" Column="1" TopLine="112"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="chessdrawer.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="20" Column="42" TopLine="13"/> <Caret Line="8" Column="73" TopLine="1"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="chessdrawer.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="19" Column="20" TopLine="7"/> <Caret Line="131" Column="15" TopLine="102"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="chessconfig.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="17" Column="28" TopLine="4"/> <Caret Line="121" Column="21" TopLine="110"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="chessdrawer.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="25" Column="22" TopLine="12"/> <Caret Line="32" Column="24" TopLine="9"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="chessdrawer.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="131" Column="1" TopLine="117"/> <Caret Line="185" Column="29" TopLine="171"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="chessdrawer.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="9" Column="5" TopLine="1"/> <Caret Line="71" Column="38" TopLine="111"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="chessdrawer.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="103" Column="39" TopLine="91"/> <Caret Line="113" Column="70" TopLine="99"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="chessdrawer.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="124" Column="6" TopLine="112"/> <Caret Line="119" Column="21" TopLine="105"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="chessdrawer.pas"/> <Filename Value="chessdrawer.pas"/>
<Caret Line="136" Column="31" TopLine="120"/> <Caret Line="106" Column="36" TopLine="99"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>

View File

@@ -18,10 +18,8 @@ object formChess: TformChess
TabOrder = 0 TabOrder = 0
TabStop = True TabStop = True
object pageStart: TUNBPage object pageStart: TUNBPage
Left = 0 ClientWidth = 240
Height = 300 ClientHeight = 300
Top = 0
Width = 240
object Label1: TLabel object Label1: TLabel
Left = 0 Left = 0
Height = 32 Height = 32
@@ -72,7 +70,7 @@ object formChess: TformChess
end end
object editPlayerName: TLabeledEdit object editPlayerName: TLabeledEdit
Left = 104 Left = 104
Height = 22 Height = 21
Top = 80 Top = 80
Width = 120 Width = 120
EditLabel.AnchorSideLeft.Control = editPlayerName EditLabel.AnchorSideLeft.Control = editPlayerName
@@ -80,10 +78,10 @@ object formChess: TformChess
EditLabel.AnchorSideTop.Side = asrCenter EditLabel.AnchorSideTop.Side = asrCenter
EditLabel.AnchorSideRight.Control = editPlayerName EditLabel.AnchorSideRight.Control = editPlayerName
EditLabel.AnchorSideBottom.Control = editPlayerName EditLabel.AnchorSideBottom.Control = editPlayerName
EditLabel.Left = 22 EditLabel.Left = 40
EditLabel.Height = 17 EditLabel.Height = 14
EditLabel.Top = 83 EditLabel.Top = 83
EditLabel.Width = 79 EditLabel.Width = 61
EditLabel.Caption = 'Player Name' EditLabel.Caption = 'Player Name'
EditLabel.ParentColor = False EditLabel.ParentColor = False
LabelPosition = lpLeft LabelPosition = lpLeft
@@ -91,9 +89,9 @@ object formChess: TformChess
end end
object Label6: TLabel object Label6: TLabel
Left = 21 Left = 21
Height = 17 Height = 14
Top = 112 Top = 112
Width = 52 Width = 43
Caption = 'Start as:' Caption = 'Start as:'
ParentColor = False ParentColor = False
end end
@@ -102,7 +100,7 @@ object formChess: TformChess
Height = 21 Height = 21
Top = 111 Top = 111
Width = 120 Width = 120
ItemHeight = 0 ItemHeight = 13
ItemIndex = 0 ItemIndex = 0
Items.Strings = ( Items.Strings = (
'White' 'White'
@@ -113,10 +111,8 @@ object formChess: TformChess
end end
end end
object pageConfigConnection: TUNBPage object pageConfigConnection: TUNBPage
Left = 0 ClientWidth = 240
Height = 300 ClientHeight = 300
Top = 0
Width = 240
object Label3: TLabel object Label3: TLabel
Left = 0 Left = 0
Height = 32 Height = 32
@@ -180,10 +176,8 @@ object formChess: TformChess
end end
end end
object pageConnecting: TUNBPage object pageConnecting: TUNBPage
Left = 0 ClientWidth = 240
Height = 300 ClientHeight = 300
Top = 0
Width = 240
object Label4: TLabel object Label4: TLabel
Left = 0 Left = 0
Height = 32 Height = 32
@@ -205,10 +199,8 @@ object formChess: TformChess
end end
end end
object pageGame: TUNBPage object pageGame: TUNBPage
Left = 0 ClientWidth = 240
Height = 300 ClientHeight = 300
Top = 0
Width = 240
object Label5: TLabel object Label5: TLabel
Left = 0 Left = 0
Height = 32 Height = 32

View File

@@ -56,7 +56,7 @@ procedure TformChess.HandleMainScreenButton(Sender: TObject);
begin begin
if Sender = btnSinglePlayer then if Sender = btnSinglePlayer then
begin begin
notebookMain.PageIndex := 2; notebookMain.PageIndex := 3;
vChessGame.StartNewGame(comboStartColor.ItemIndex); vChessGame.StartNewGame(comboStartColor.ItemIndex);
end end
else if Sender = btnDirectComm then notebookMain.PageIndex := 1; else if Sender = btnDirectComm then notebookMain.PageIndex := 1;
@@ -67,7 +67,7 @@ begin
// Creation of internal components // Creation of internal components
vChessDrawer := TChessDrawer.Create(Self); vChessDrawer := TChessDrawer.Create(Self);
vChessDrawer.Parent := pageGame; vChessDrawer.Parent := pageGame;
vChessDrawer.Top := 20; vChessDrawer.Top := 50;
vChessDrawer.Left := 20; vChessDrawer.Left := 20;
vChessDrawer.Height := INT_CHESSBOARD_SIZE; vChessDrawer.Height := INT_CHESSBOARD_SIZE;
vChessDrawer.Width := INT_CHESSBOARD_SIZE; vChessDrawer.Width := INT_CHESSBOARD_SIZE;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B