Changeset 36 for trunk/Forms/UMainForm.pas
- Timestamp:
- Jan 1, 2018, 8:57:03 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UMainForm.pas
r34 r36 6 6 7 7 uses 8 Registry, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, 9 ComCtrls, Menus, ActnList, UCore, UPlatform, Math, DateUtils, GraphType, 10 UPersistentForm, UApplicationInfo, UCoolTranslator, LCLType, URegistry; 8 Registry, XMLConf, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, 9 Dialogs, ExtCtrls, ComCtrls, Menus, ActnList, UCore, UPlatform, Math, 10 DateUtils, GraphType, UPersistentForm, UApplicationInfo, UCoolTranslator, 11 LCLType, URegistry; 11 12 12 13 type … … 37 38 TimerDraw: TTimer; 38 39 TimerEngineTick: TTimer; 40 XMLConfig1: TXMLConfig; 39 41 procedure AExitExecute(Sender: TObject); 40 42 procedure AFullScreenExecute(Sender: TObject); … … 60 62 DrawDuration: TDateTime; 61 63 Drawing: Boolean; 64 procedure LoadConfig; 65 procedure SaveConfig; 62 66 public 63 67 PersistentForm: TPersistentForm; … … 110 114 end; 111 115 116 procedure TMainForm.LoadConfig; 117 begin 118 if not FileExists(XMLConfig1.Filename) then Exit; 119 if Assigned(Engine) then Engine.LoadConfig(XMLConfig1, ''); 120 end; 121 122 procedure TMainForm.SaveConfig; 123 begin 124 if Assigned(Engine) then Engine.SaveConfig(XMLConfig1, ''); 125 XMLConfig1.Flush; 126 end; 127 112 128 procedure TMainForm.EraseBackground(DC: HDC); 113 129 begin … … 117 133 procedure TMainForm.FormCreate(Sender: TObject); 118 134 begin 135 XMLConfig1.Filename := GetAppConfigDir(False) + 'Config.xml'; 136 119 137 PersistentForm := TPersistentForm.Create(nil); 120 138 PersistentForm.RegistryContext := RegContext(HKEY(ApplicationInfo1.RegistryRoot), … … 126 144 Engine := TEngine.Create; 127 145 Engine.Bitmap := Image1.Picture.Bitmap; 146 LoadConfig; 128 147 Engine.NewGame; 129 148 Engine.Active := True; … … 193 212 begin 194 213 PersistentForm.Save(Self); 214 SaveConfig; 195 215 end; 196 216
Note:
See TracChangeset
for help on using the changeset viewer.