Changeset 62 for trunk/Forms
- Timestamp:
- Nov 25, 2020, 4:25:09 PM (4 years ago)
- Location:
- trunk/Forms
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r61 r62 35 35 Top = 21 36 36 end 37 object Translator1: TTranslator 38 POFilesFolder = 'Languages' 39 Left = 496 40 Top = 358 41 end 42 object ApplicationInfo1: TApplicationInfo 43 Identification = 1 44 VersionMajor = 1 45 VersionMinor = 1 46 VersionBugFix = 0 47 HomePage = 'https://app.zdechov.net/BigMetro' 48 AuthorsName = 'Chronosoft' 49 EmailContact = 'robie@centrum.cz' 50 AppName = 'Big Metro' 51 Description = 'Enjoyable real-time metro building game.' 52 ReleaseDate = 44160 53 RegistryKey = '\Software\Chronosoft\BigMetro' 54 RegistryRoot = rrKeyCurrentUser 55 License = 'CC0' 56 Left = 484 57 Top = 460 58 end 37 59 end -
trunk/Forms/UFormMain.pas
r51 r62 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus, 9 ExtCtrls, UEngine, LCLType, types ;9 ExtCtrls, UEngine, LCLType, types, UTranslator, UApplicationInfo, URegistry; 10 10 11 11 type … … 14 14 15 15 TFormMain = class(TForm) 16 ApplicationInfo1: TApplicationInfo; 16 17 PaintBox1: TPaintBox; 17 18 Timer1: TTimer; 19 Translator1: TTranslator; 18 20 procedure FormCreate(Sender: TObject); 19 21 procedure FormDestroy(Sender: TObject); … … 33 35 procedure PaintBox1Resize(Sender: TObject); 34 36 procedure Timer1Timer(Sender: TObject); 37 private 38 procedure LoadConfig; 39 procedure SaveConfig; 35 40 public 36 41 Engine: TEngine; … … 52 57 procedure TFormMain.FormCreate(Sender: TObject); 53 58 begin 59 LoadConfig; 54 60 Engine := TEngine.Create; 55 61 //PaintBox1.ControlStyle := [csOpaque]; 62 Randomize; 56 63 end; 57 64 … … 59 66 begin 60 67 Engine.Free; 68 SaveConfig; 61 69 end; 62 70 … … 76 84 Engine.Map.Size := Point(PaintBox1.Width, PaintBox1.Height); 77 85 Engine.View.DestRect := Rect(0, 0, PaintBox1.Width, PaintBox1.Height); 78 Engine. Reset;86 Engine.MainMenu; 79 87 end; 80 88 … … 132 140 end; 133 141 142 procedure TFormMain.LoadConfig; 143 var 144 LangCode: string; 145 begin 146 with TRegistryEx.Create do 147 try 148 CurrentContext := ApplicationInfo1.GetRegistryContext; 149 150 if ValueExists('LanguageCode') then begin 151 LangCode := ReadStringWithDefault('LanguageCode', ''); 152 Translator1.Language := Translator1.Languages.SearchByCode(LangCode); 153 end else Translator1.Language := Translator1.Languages.SearchByCode(''); 154 //ThemeManager1.Theme := ThemeManager1.Themes.FindByName(ReadStringWithDefault('Theme', 'System')); 155 finally 156 Free; 157 end; 158 end; 159 160 procedure TFormMain.SaveConfig; 161 begin 162 with TRegistryEx.Create do 163 try 164 CurrentContext := ApplicationInfo1.GetRegistryContext; 165 166 if Assigned(Translator1.Language) and (Translator1.Language.Code <> '') then 167 WriteString('LanguageCode', Translator1.Language.Code) 168 else DeleteValue('LanguageCode'); 169 //WriteString('Theme', ThemeManager1.Theme.Name); 170 finally 171 Free; 172 end; 173 end; 174 175 134 176 end. 135 177
Note:
See TracChangeset
for help on using the changeset viewer.