Ignore:
Timestamp:
May 19, 2021, 11:30:41 AM (3 years ago)
Author:
chronos
Message:
  • Added: Control icons for Pause, Play and Fast forward.
  • Modified: Image buttons changed to custom TImage control with Enabled property supported.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r76 r77  
    4646    procedure LoadGraphicAssets;
    4747    procedure DarkModeChange(Sender: TObject);
     48    procedure CopyImage(DestBmp: TBitmap; SourceBmp: TBitmap; Grayed: Boolean = False);
    4849  public
    4950    FullScreen: Boolean;
     
    8586begin
    8687  SaveConfig;
    87   Engine.Free;
     88  FreeAndNil(Engine);
    8889end;
    8990
     
    216217procedure TFormMain.LoadGraphicAssets;
    217218begin
    218   Engine.ImagePassenger.Picture.Assign(FormImages.ImagePassenger.Picture);
    219   Engine.ImageLocomotive.Picture.Assign(FormImages.ImageLocomotive.Picture);
    220   Engine.ButtonBack.Bitmap.Assign(FormImages.ImageLeftArrow.Picture.Bitmap);
     219  CopyImage(Engine.ImagePassenger.Bitmap, FormImages.ImagePassenger.Picture.Bitmap);
     220  CopyImage(Engine.ImagePassenger.BitmapDisabled, FormImages.ImagePassenger.Picture.Bitmap, True);
     221  CopyImage(Engine.ImageLocomotive.Bitmap, FormImages.ImageLocomotive.Picture.Bitmap);
     222  CopyImage(Engine.ImageLocomotive.BitmapDisabled, FormImages.ImageLocomotive.Picture.Bitmap, True);
     223  CopyImage(Engine.ButtonBack.Bitmap, FormImages.ImageLeftArrow.Picture.Bitmap);
     224  CopyImage(Engine.ButtonBack.BitmapDisabled, FormImages.ImageLeftArrow.Picture.Bitmap, True);
     225  CopyImage(Engine.ImagePlay.Bitmap, FormImages.ImagePlay.Picture.Bitmap);
     226  CopyImage(Engine.ImagePlay.BitmapDisabled, FormImages.ImagePlay.Picture.Bitmap, True);
     227  CopyImage(Engine.ImagePause.Bitmap, FormImages.ImagePause.Picture.Bitmap);
     228  CopyImage(Engine.ImagePause.BitmapDisabled, FormImages.ImagePause.Picture.Bitmap, True);
     229  CopyImage(Engine.ImageFastForward.Bitmap, FormImages.ImageFastForward.Picture.Bitmap);
     230  CopyImage(Engine.ImageFastForward.BitmapDisabled, FormImages.ImageFastForward.Picture.Bitmap, True);
    221231  if Engine.DarkMode then begin
    222     BitmapInvert(Engine.ImagePassenger.Picture.Bitmap);
    223     BitmapInvert(Engine.ImageLocomotive.Picture.Bitmap);
     232    BitmapInvert(Engine.ImagePassenger.Bitmap);
     233    BitmapInvert(Engine.ImagePassenger.BitmapDisabled);
     234    BitmapInvert(Engine.ImageLocomotive.Bitmap);
     235    BitmapInvert(Engine.ImageLocomotive.BitmapDisabled);
    224236    BitmapInvert(Engine.ButtonBack.Bitmap);
     237    BitmapInvert(Engine.ButtonBack.BitmapDisabled);
     238    BitmapInvert(Engine.ImagePlay.Bitmap);
     239    BitmapInvert(Engine.ImagePlay.BitmapDisabled);
     240    BitmapInvert(Engine.ImagePause.Bitmap);
     241    BitmapInvert(Engine.ImagePause.BitmapDisabled);
     242    BitmapInvert(Engine.ImageFastForward.Bitmap);
     243    BitmapInvert(Engine.ImageFastForward.BitmapDisabled);
    225244  end;
    226245end;
     
    231250end;
    232251
     252procedure TFormMain.CopyImage(DestBmp: TBitmap; SourceBmp: TBitmap;
     253  Grayed: Boolean);
     254begin
     255  DestBmp.PixelFormat := SourceBmp.PixelFormat;
     256  DestBmp.SetSize(0, 0);
     257  DestBmp.SetSize(SourceBmp.Width, SourceBmp.Height);
     258  BitmapCopyRect(DestBmp, Bounds(0, 0, DestBmp.Width, DestBmp.Height), SourceBmp,
     259    Point(0, 0));
     260  if Grayed then BitmapBlendColor(DestBmp, $ffffffff);
     261end;
     262
    233263
    234264end.
Note: See TracChangeset for help on using the changeset viewer.