Changeset 69 for trunk/Forms


Ignore:
Timestamp:
Nov 28, 2020, 12:35:06 PM (4 years ago)
Author:
chronos
Message:
  • Fixed: Restore from fulscreen mode to maximized state not retaining normal state dimensions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r68 r69  
    7373procedure TFormMain.FormActivate(Sender: TObject);
    7474begin
     75end;
     76
     77procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction);
     78begin
     79  PersistentForm1.Save(Self);
     80end;
     81
     82procedure TFormMain.FormDestroy(Sender: TObject);
     83begin
     84  SaveConfig;
     85  Engine.Free;
     86end;
     87
     88procedure TFormMain.FormKeyPress(Sender: TObject; var Key: char);
     89begin
     90  if Key = #32 then begin
     91    if Engine.State = gsRunning then Engine.State := gsPaused
     92    else if Engine.State = gsPaused then Engine.State := gsRunning;
     93  end;
     94end;
     95
     96procedure TFormMain.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState
     97  );
     98const
     99  KeyF11 = 122;
     100begin
     101  if Key = KeyF11 then begin
     102    FullScreen := not FullScreen;
     103    PersistentForm1.SetFullScreen(FormMain.FullScreen);
     104  end else
     105    Engine.KeyUp(Key);
     106end;
     107
     108procedure TFormMain.FormShow(Sender: TObject);
     109begin
    75110  if not Initialized then begin
    76111    Initialized := True;
     
    78113    PersistentForm1.Load(Self, False, True);
    79114    FullScreen := PersistentForm1.FormFullScreen;
    80     Randomize;
    81115    Engine.InitMenus;
    82116    Engine.ImagePassenger.Picture.Assign(FormImages.ImagePassenger.Picture);
     
    86120    Engine.MainMenu;
    87121  end;
    88 end;
    89 
    90 procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction);
    91 begin
    92   PersistentForm1.Save(Self);
    93 end;
    94 
    95 procedure TFormMain.FormDestroy(Sender: TObject);
    96 begin
    97   SaveConfig;
    98   Engine.Free;
    99 end;
    100 
    101 procedure TFormMain.FormKeyPress(Sender: TObject; var Key: char);
    102 begin
    103   if Key = #32 then begin
    104     if Engine.State = gsRunning then Engine.State := gsPaused
    105     else if Engine.State = gsPaused then Engine.State := gsRunning;
    106   end;
    107 end;
    108 
    109 procedure TFormMain.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState
    110   );
    111 const
    112   KeyF11 = 122;
    113 begin
    114   if Key = KeyF11 then begin
    115     FullScreen := not FullScreen;
    116     PersistentForm1.SetFullScreen(FormMain.FullScreen);
    117   end else
    118     Engine.KeyUp(Key);
    119 end;
    120 
    121 procedure TFormMain.FormShow(Sender: TObject);
    122 begin
    123122end;
    124123
Note: See TracChangeset for help on using the changeset viewer.