fpchess: Some fixes

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1845 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2011-08-27 21:16:40 +00:00
parent 797e6dfabd
commit de135f4ea0
4 changed files with 34 additions and 23 deletions

View File

@ -1,7 +1,7 @@
object formChess: TformChess
Left = 216
Left = 318
Height = 433
Top = 164
Top = 123
Width = 360
ActiveControl = notebookMain
Caption = 'FP Chess 0.1'
@ -123,8 +123,9 @@ object formChess: TformChess
Left = 8
Height = 21
Top = 74
Width = 338
Width = 346
ItemHeight = 0
OnChange = comboGameModeSelect
OnSelect = comboGameModeSelect
TabOrder = 5
Text = 'comboGameMode'
@ -168,8 +169,8 @@ object formChess: TformChess
end
end
object pageGame: TPage
ClientWidth = 360
ClientHeight = 433
ClientWidth = 720
ClientHeight = 866
object Label5: TLabel
AnchorSideRight.Control = pageGame
AnchorSideRight.Side = asrBottom
@ -201,10 +202,17 @@ object formChess: TformChess
Caption = 'labelTime'
ParentColor = False
end
object memoDebug: TMemo
Left = 8
Height = 106
Top = 440
Width = 344
TabOrder = 0
end
end
object pageWebservice: TPage
ClientWidth = 360
ClientHeight = 433
ClientWidth = 720
ClientHeight = 866
object Label8: TLabel
Left = 0
Height = 32

View File

@ -46,6 +46,7 @@ type
editWebServiceAI: TLabeledEdit;
labelPos: TLabel;
editPlayerName: TLabeledEdit;
memoDebug: TMemo;
pageStart: TPage;
notebookMain: TNotebook;
panelModules: TPanel;
@ -121,7 +122,7 @@ begin
if ANewIndex = gSelectedModuleIndex then Exit;
lModule := GetChessModule(gSelectedModuleIndex);
if lModule <> nil then lModule.FreeUserInterface();
if lModule <> nil then lModule.HideUserInterface();
GetChessModule(ANewIndex).ShowUserInterface(panelModules);
end;
@ -170,7 +171,9 @@ begin
begin
comboGameMode.ItemIndex := 0;
UpdateChessModulesUI(0);
gSelectedModuleIndex := 0;
end;
gChessModulesDebugOutputDestiny := memoDebug.Lines;
end;
procedure TformChess.btnQuitClick(Sender: TObject);

View File

@ -20,9 +20,9 @@ uses
type
{ TSinglePlayerChessModule }
{ TFICSChessModule }
TSinglePlayerChessModule = class(TChessModule)
TFICSChessModule = class(TChessModule)
public
SecondPlayerName: string;
constructor Create();
@ -38,9 +38,9 @@ type
implementation
{ TSinglePlayerChessModule }
{ TFICSChessModule }
constructor TSinglePlayerChessModule.Create;
constructor TFICSChessModule.Create;
begin
inherited Create;
@ -48,7 +48,7 @@ begin
Kind := cmkSinglePlayer;
end;
procedure TSinglePlayerChessModule.CreateUserInterface;
procedure TFICSChessModule.CreateUserInterface;
begin
{ textSecondPlayerName := TStaticText.Create(nil);
textSecondPlayerName.SetBounds(20, 20, 180, 50);
@ -59,48 +59,48 @@ begin
editSecondPlayerName.Text := 'Second player';}
end;
procedure TSinglePlayerChessModule.ShowUserInterface(AParent: TWinControl);
procedure TFICSChessModule.ShowUserInterface(AParent: TWinControl);
begin
{ textSecondPlayerName.Parent := AParent;
editSecondPlayerName.Parent := AParent;}
end;
procedure TSinglePlayerChessModule.HideUserInterface();
procedure TFICSChessModule.HideUserInterface();
begin
{ textSecondPlayerName.Parent := nil;
editSecondPlayerName.Parent := nil;}
end;
procedure TSinglePlayerChessModule.FreeUserInterface;
procedure TFICSChessModule.FreeUserInterface;
begin
{ textSecondPlayerName.Free;
editSecondPlayerName.Free;}
end;
procedure TSinglePlayerChessModule.PrepareForGame;
procedure TFICSChessModule.PrepareForGame;
begin
// SecondPlayerName := editSecondPlayerName.Text;
ChessModuleDebugLn('[TSinglePlayerChessModule.PrepareForGame]');
ChessModuleDebugLn('[TFICSChessModule.PrepareForGame]');
end;
function TSinglePlayerChessModule.IsMovingAllowedNow: Boolean;
function TFICSChessModule.IsMovingAllowedNow: Boolean;
begin
Result := not (vChessGame.IsWhitePlayerTurn xor vChessGame.FirstPlayerIsWhite);
end;
function TSinglePlayerChessModule.GetSecondPlayerName: string;
function TFICSChessModule.GetSecondPlayerName: string;
begin
// Result := SecondPlayerName;
end;
// If a move came, it is because the local player did a move
// so send this move and start listening for a move
procedure TSinglePlayerChessModule.HandleOnMove(AFrom, ATo: TPoint);
procedure TFICSChessModule.HandleOnMove(AFrom, ATo: TPoint);
begin
end;
initialization
RegisterChessModule(TSinglePlayerChessModule.Create);
RegisterChessModule(TFICSChessModule.Create);
end.

View File

@ -65,7 +65,7 @@ begin
editSecondPlayerName.Parent := nil;
end;
procedure TSinglePlayerChessModule.FreeUserInterface;
procedure TSinglePlayerChessModule.FreeUserInterface();
begin
textSecondPlayerName.Free;
editSecondPlayerName.Free;