{ - dodelat dalsi atribut k evidovani } unit ChessBoard; interface uses IniFiles, Forms, Graphics, SysUtils; type TChessboard = class private Color1 : TColor; Color2 : TColor; TurnSide : boolean; public constructor Create(); destructor Destroy(); procedure SetColorSheme(Col1, Col2 : TColor); function GetColor1(): TColor; function GetColor2(): TColor; procedure SetTurnSide(Turn : boolean); function GetTurnSide: boolean; procedure ChangeTurnSide; end; implementation constructor TChessboard.Create(); var INIFile : TINIFile; begin // nastaveni barev hraci plochy inicializace z ini souboru INIFile := TiniFile.Create((ExtractFilePath(Application.exename))+'chess.ini'); Color1 := INIFile.ReadInteger('Chessboard','Color1',8421504); Color2 := INIFile.ReadInteger('Chessboard','Color2',16777215); INIFile.Free; // nastaveni zacinajici strany TurnSide := true; end; destructor TChessboard.Destroy; var INIFile : TINIFile; begin // ulozeni nastaveni do souboru INIFile := TiniFile.Create((ExtractFilePath(Application.exename))+'chess.ini'); INIFile.WriteInteger('Chessboard','Color1',Color1); INIFile.WriteInteger('Chessboard','Color2',Color2); INIFile.Free; end; procedure TChessboard.SetColorSheme(Col1: TColor; Col2: TColor); begin Color1 := Col1; Color2 := Col2; end; function TChessboard.GetColor1; begin GetColor1 := Color1; end; function TChessboard.GetColor2; begin GetColor2 := Color2; end; procedure TChessboard.SetTurnSide(Turn: Boolean); begin TurnSide := Turn; end; function TChessboard.GetTurnSide; begin GetTurnSide := TurnSide; end; procedure TChessboard.ChangeTurnSide; begin if TurnSide then TurnSide := false else TurnSide := true; end; end.