Advertisement
ganryu

Constructor Tablero

Jun 26th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.88 KB | None | 0 0
  1. constructor TForm2.TTablero.Create(Panel: TPanel; Filas, Columnas: Integer);
  2. var
  3.   Fila : Integer;
  4.   Columna : Integer;
  5.   Path : String;
  6. begin
  7.   // Setear el número de filas y columnas en el tablero
  8.   Self.Filas := Filas;
  9.   Self.Columnas := Columnas;
  10.   SetLength(Board, Filas, Columnas);
  11.  
  12.   // Reservar espacio para las imágenes de los botones e inicializarlas
  13.   imagenBase := TBitmap.Create;
  14.   imagenAzul := TBitmap.Create;
  15.   imagenRoja := TBitmap.Create;
  16.   Path := ExtractFilePath(Application.ExeName);
  17.   imagenBase.LoadFromFile(Path + 'base.bmp');
  18.   imagenAzul.LoadFromFile(Path + 'azulcirc.bmp');
  19.   imagenRoja.LoadFromFile(Path + 'rojocirc.bmp');
  20.  
  21.   // Reservar espacio para el tablero de imágenes
  22.   for Fila := 0 to Filas - 1 do begin
  23.     for Columna := 0 to Columnas - 1 do begin
  24.       Board[Fila][Columna] := TCasilla.Create(Panel, Fila, Columna);
  25.     end;
  26.   end;
  27. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement