Changeset 417 for trunk/Start.pas


Ignore:
Timestamp:
Nov 17, 2021, 11:11:01 AM (3 years ago)
Author:
chronos
Message:
  • Modified: Merged LoadGraphicSet and LoadGraphicSet2 into single method.
  • Modified: Moved brain load picture code into TBrain.LoadPicture method.
  • Added: Brain pictures loaded as TGraphicSetItem.
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Start.pas

    r416 r417  
    1010
    1111type
    12 
    1312  { TPlayerSlot }
    1413
     
    295294    CustomizeBtn.ButtonIndex := 2;
    296295
    297   BitBltBitmap(BrainNoTerm.Picture, 0, 0, 64, 64, HGrSystem2.Data, 1, 111);
    298   BitBltBitmap(BrainSuperVirtual.Picture, 0, 0, 64, 64, HGrSystem2.Data, 66, 111);
    299   BitBltBitmap(BrainTerm.Picture, 0, 0, 64, 64, HGrSystem2.Data, 131, 111);
    300   BitBltBitmap(BrainRandom.Picture, 0, 0, 64, 64, HGrSystem2.Data, 131, 46);
     296  BitBltBitmap(BrainNoTerm.Picture, 0, 0, 64, 64, HGrSystem2.Data, GBrainNoTerm.Left, GBrainNoTerm.Top);
     297  BitBltBitmap(BrainSuperVirtual.Picture, 0, 0, 64, 64, HGrSystem2.Data, GBrainSuperVirtual.Left, GBrainSuperVirtual.Top);
     298  BitBltBitmap(BrainTerm.Picture, 0, 0, 64, 64, HGrSystem2.Data, GBrainTerm.Left, GBrainTerm.Top);
     299  BitBltBitmap(BrainRandom.Picture, 0, 0, 64, 64, HGrSystem2.Data, GBrainRandom.Left, GBrainRandom.Top);
     300
    301301  LoadAiBrainsPictures;
    302302
     
    480480procedure TStartDlg.LoadAiBrainsPictures;
    481481var
    482   AIBrains: TBrains;
    483   I: Integer;
    484   TextSize: TSize;
    485 begin
    486   AIBrains := TBrains.Create(False);
    487   Brains.GetByKind(btAI, AIBrains);
    488   for i := 0 to AIBrains.Count - 1 do
    489   with AIBrains[I] do begin
    490     if not LoadGraphicFile(AIBrains[i].Picture, GetAiDir + DirectorySeparator +
    491       FileName + DirectorySeparator + FileName + '.png', [gfNoError]) then begin
    492       with AIBrains[i].Picture.Canvas do begin
    493         Brush.Color := $904830;
    494         FillRect(Rect(0, 0, 64, 64));
    495         Font.Assign(UniFont[ftTiny]);
    496         Font.Style := [];
    497         Font.Color := $5FDBFF;
    498         TextSize := TextExtent(FileName);
    499         Textout(32 - TextSize.Width div 2,
    500           32 - TextSize.Height div 2, FileName);
    501       end;
    502     end;
    503   end;
    504   FreeAndNil(AIBrains);
     482  AiBrains: TBrains;
     483begin
     484  AiBrains := TBrains.Create(False);
     485  try
     486    Brains.GetByKind(btAI, AiBrains);
     487    AiBrains.LoadPictures;
     488  finally
     489    FreeAndNil(AiBrains);
     490  end;
    505491end;
    506492
     
    727713    begin
    728714      for i := 12 to 19 do
    729         if (i < 13) or (i > 17) then
    730         begin
     715        if (i < 13) or (i > 17) then begin
    731716          BitBltCanvas(Canvas, 9 + i * 27, yLogo - 2, Ornament.Width, Ornament.Height,
    732717            HGrSystem2.Mask.Canvas, Ornament.Left, Ornament.Top, SRCAND);
     
    813798
    814799      for i := 0 to 19 do
    815         if (i < 2) or (i > 6) then
    816         begin
     800        if (i < 2) or (i > 6) then begin
    817801          BitBltCanvas(Canvas, 9 + i * 27, yLogo - 2, Ornament.Width, Ornament.Height,
    818802            HGrSystem2.Mask.Canvas, Ornament.Left, Ornament.Top, SRCAND);
Note: See TracChangeset for help on using the changeset viewer.