Changeset 64 for trunk/Forms


Ignore:
Timestamp:
Nov 26, 2020, 4:58:02 PM (4 years ago)
Author:
chronos
Message:
  • Added: Support for dark mode.
  • Added: Top left back button to exit from game to game menu. Allow to restart game and continue with playing.
  • Added: Support for Escape key for exiting game and menu.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r63 r64  
    6565procedure TFormMain.FormCreate(Sender: TObject);
    6666begin
     67  Engine := TEngine.Create;
    6768  LoadConfig;
    68   Engine := TEngine.Create;
    6969  //PaintBox1.ControlStyle := [csOpaque];
    7070  Randomize;
     
    8585procedure TFormMain.FormDestroy(Sender: TObject);
    8686begin
     87  SaveConfig;
    8788  Engine.Free;
    88   SaveConfig;
    8989end;
    9090
     
    103103begin
    104104  if Key = KeyF11 then begin
    105     FormMain.FullScreen := not FormMain.FullScreen;
    106     FormMain.PersistentForm1.SetFullScreen(FormMain.FullScreen);
    107   end;
     105    FullScreen := not FullScreen;
     106    PersistentForm1.SetFullScreen(FormMain.FullScreen);
     107  end else
     108    Engine.KeyUp(Key);
    108109end;
    109110
     
    112113  PersistentForm1.RegistryContext := ApplicationInfo1.GetRegistryContext;
    113114  PersistentForm1.Load(Self, False, True);
     115  FullScreen := PersistentForm1.FormFullScreen;
    114116  Randomize;
     117  Engine.InitMenus;
    115118  Engine.ImagePassenger.Picture.Assign(FormImages.ImagePassenger.Picture);
    116119  Engine.ImageLocomotive.Picture.Assign(FormImages.ImageLocomotive.Picture);
     
    185188      Translator1.Language := Translator1.Languages.SearchByCode(LangCode);
    186189    end else Translator1.Language := Translator1.Languages.SearchByCode('');
    187     //ThemeManager1.Theme := ThemeManager1.Themes.FindByName(ReadStringWithDefault('Theme', 'System'));
     190    Engine.DarkMode := ReadBoolWithDefault('DarkMode', False);
    188191  finally
    189192    Free;
     
    200203      WriteString('LanguageCode', Translator1.Language.Code)
    201204      else DeleteValue('LanguageCode');
    202     //WriteString('Theme', ThemeManager1.Theme.Name);
     205    WriteBool('DarkMode', Engine.DarkMode);
    203206  finally
    204207    Free;
Note: See TracChangeset for help on using the changeset viewer.