Changeset 514 for trunk/Start.pas


Ignore:
Timestamp:
Jan 3, 2024, 3:05:32 PM (11 months ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Start.pas

    r511 r514  
    114114    FormerGames: TStringList;
    115115    Maps: TStringList;
    116     LogoBuffer: TBitmap;
    117116    // BookDate: string;
    118117    PlayerSlots: TPlayerSlots;
     
    181180  ActionSideBorder = 24;
    182181  ActionBottomBorder = 10;
    183   wBuffer = 91;
    184182  x0Mini = 437;
    185183  y0Mini = 178;
     
    308306  EmptyPicture.SetSize(64, 64);
    309307  EmptyPicture.Canvas.FillRect(0, 0, EmptyPicture.Width, EmptyPicture.Height);
    310   LogoBuffer := TBitmap.Create;
    311   LogoBuffer.PixelFormat := TPixelFormat.pf24bit;
    312   LogoBuffer.SetSize(wBuffer, 56);
    313   LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height);
    314308
    315309  MiniMap := TMiniMap.Create;
     
    336330  FreeAndNil(Maps);
    337331  FreeAndNil(EmptyPicture);
    338   FreeAndNil(LogoBuffer);
    339332  FreeAndNil(PlayerSlots);
    340333  FreeAndNil(MiniMap);
     
    537530    $000000, xAction, Y + 21, Phrases2.Lookup(TextItem));
    538531
    539   UnshareBitmap(LogoBuffer);
    540   BitBltCanvas(LogoBuffer.Canvas, 0, 0, 50, 50, Canvas,
     532  UnshareBitmap(DrawBuffer);
     533  DrawBufferEnsureSize(50, 50);
     534  BitBltCanvas(DrawBuffer.Canvas, 0, 0, 50, 50, Canvas,
    541535    xActionIcon - 2, Y - 2);
    542   GlowFrame(LogoBuffer, 8, 8, 34, 34, $202020);
     536  GlowFrame(DrawBuffer, 8, 8, 34, 34, $202020);
    543537  BitBltCanvas(Canvas, xActionIcon - 2, Y - 2, 50, 50,
    544     LogoBuffer.Canvas, 0, 0);
     538    DrawBuffer.Canvas, 0, 0);
    545539  BitBltCanvas(Canvas, xActionIcon, Y, 40, 40, BigImp.Canvas,
    546540    (IconIndex mod 7) * xSizeBig + 8, (IconIndex div 7) * ySizeBig);
     
    637631
    638632  // Paint menu logo
    639   UnshareBitmap(LogoBuffer);
    640   BitBltCanvas(LogoBuffer.Canvas, 0, 0, MenuLogo.Width, MenuLogo.Height, Canvas, 6,
     633  UnshareBitmap(DrawBuffer);
     634  DrawBufferEnsureSize(MenuLogo.Width, MenuLogo.Height);
     635  BitBltCanvas(DrawBuffer.Canvas, 0, 0, MenuLogo.Width, MenuLogo.Height, Canvas, 6,
    641636    3 + 2 * Integer(Tab <> tbMain));
    642637
    643   ImageOp_BCC(LogoBuffer, Templates.Data, 0, 0, MenuLogo.Left, MenuLogo.Top,
     638  ImageOp_BCC(DrawBuffer, Templates.Data, 0, 0, MenuLogo.Left, MenuLogo.Top,
    644639    MenuLogo.Width, MenuLogo.Height - 9, $BFBF20, $4040DF); // logo part 1
    645   ImageOp_BCC(LogoBuffer, Templates.Data, 10, 27, MenuLogo.Left + 10,
     640  ImageOp_BCC(DrawBuffer, Templates.Data, 10, 27, MenuLogo.Left + 10,
    646641    MenuLogo.Top + 27, MenuLogo.Width - 10, 9, $BFBF20, $4040DF); // logo part 2
    647642  BitBltCanvas(Canvas, 6, 3 + 2 * Integer(Tab <> tbMain), MenuLogo.Width, MenuLogo.Height,
    648     LogoBuffer.Canvas, 0, 0);
     643    DrawBuffer.Canvas, 0, 0);
    649644
    650645  if Page = pgMain then begin
    651    if SelectedAction <> maNone then // mark selected action
    652       for I := 0 to (ClientWidth - 2 * ActionSideBorder) div wBuffer + 1 do
    653       begin
    654         W := ClientWidth - 2 * ActionSideBorder - I * wBuffer;
    655         if W > wBuffer then
    656           W := wBuffer;
    657         H := ActionPitch;
    658         if yAction + Integer(SelectedAction) * ActionPitch - 8 + H > ClientHeight - ActionBottomBorder
    659         then
    660           H := ClientHeight - ActionBottomBorder -
    661             (yAction + Integer(SelectedAction) * ActionPitch - 8);
    662 
    663         UnshareBitmap(LogoBuffer);
    664         BitBltCanvas(LogoBuffer.Canvas, 0, 0, W, H, Canvas,
    665           ActionSideBorder + I * wBuffer, yAction + Integer(SelectedAction) * ActionPitch
    666           - 8);
    667         MakeBlue(LogoBuffer, 0, 0, W, H);
    668         BitBltCanvas(Canvas, ActionSideBorder + I * wBuffer,
    669           yAction + Integer(SelectedAction) * ActionPitch - 8, W, H,
    670           LogoBuffer.Canvas, 0, 0);
    671       end;
     646    if SelectedAction <> maNone then begin
     647      // Mark selected action
     648      W := ClientWidth - 2 * ActionSideBorder;
     649      H := ActionPitch;
     650      if yAction + Integer(SelectedAction) * ActionPitch - 8 + H > ClientHeight - ActionBottomBorder
     651      then
     652        H := ClientHeight - ActionBottomBorder -
     653          (yAction + Integer(SelectedAction) * ActionPitch - 8);
     654
     655      UnshareBitmap(DrawBuffer);
     656      DrawBufferEnsureSize(W, H);
     657      BitBltCanvas(DrawBuffer.Canvas, 0, 0, W, H, Canvas,
     658        ActionSideBorder, yAction + Integer(SelectedAction) * ActionPitch - 8);
     659      MakeBlue(DrawBuffer, 0, 0, W, H);
     660      BitBltCanvas(Canvas, ActionSideBorder, yAction + Integer(SelectedAction) *
     661        ActionPitch - 8, W, H, DrawBuffer.Canvas, 0, 0);
     662    end;
    672663    Y := yAction;
    673664    for MainAction := Low(TMainActionSet) to High(TMainActionSet) do
     
    687678              Canvas.Font.Assign(UniFont[ftNormal]);
    688679
    689               UnshareBitmap(LogoBuffer);
    690               BitBltCanvas(LogoBuffer.Canvas, 0, 0, LinkArrows.Width, LinkArrows.Height, Canvas,
     680              UnshareBitmap(DrawBuffer);
     681              DrawBufferEnsureSize(LinkArrows.Width, LinkArrows.Height);
     682              BitBltCanvas(DrawBuffer.Canvas, 0, 0, LinkArrows.Width, LinkArrows.Height, Canvas,
    691683                xActionIcon, Y + 2);
    692               ImageOp_BCC(LogoBuffer, Templates.Data, Point(0, 0), LinkArrows.BoundsRect, 0,
     684              ImageOp_BCC(DrawBuffer, Templates.Data, Point(0, 0), LinkArrows.BoundsRect, 0,
    693685                Colors.Canvas.Pixels[clkAge0 - 1, cliDimmedText]);
    694686              BitBltCanvas(Canvas, xActionIcon, Y + 2, LinkArrows.Width, LinkArrows.Height,
    695                 LogoBuffer.Canvas, 0, 0);
     687                DrawBuffer.Canvas, 0, 0);
    696688            end;
    697689        end;
Note: See TracChangeset for help on using the changeset viewer.