Changeset 11 for trunk/UCore.pas
- Timestamp:
- Oct 4, 2019, 11:57:05 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r10 r11 7 7 uses 8 8 Classes, SysUtils, UTheme, UPersistentForm, UApplicationInfo, UTranslator, 9 URegistry, UGame ;9 URegistry, UGame, ActnList, Forms, Controls; 10 10 11 11 type … … 14 14 15 15 TCore = class(TDataModule) 16 AAbout: TAction; 17 ASettings: TAction; 18 ActionList1: TActionList; 19 AExit: TAction; 20 AGameNew: TAction; 16 21 ApplicationInfo1: TApplicationInfo; 17 22 PersistentForm1: TPersistentForm; 18 23 ThemeManager1: TThemeManager; 19 24 Translator1: TTranslator; 25 procedure AAboutExecute(Sender: TObject); 26 procedure AExitExecute(Sender: TObject); 27 procedure AGameNewExecute(Sender: TObject); 28 procedure ASettingsExecute(Sender: TObject); 20 29 procedure DataModuleCreate(Sender: TObject); 21 30 procedure DataModuleDestroy(Sender: TObject); … … 36 45 37 46 uses 38 UFormMain ;47 UFormMain, UFormSettings, UFormAbout, UFormNew; 39 48 40 49 { TCore } … … 49 58 end; 50 59 60 procedure TCore.ASettingsExecute(Sender: TObject); 61 begin 62 FormSettings := TFormSettings.Create(nil); 63 try 64 FormSettings.ShowModal; 65 finally 66 FreeAndNil(FormSettings); 67 end; 68 end; 69 70 procedure TCore.AAboutExecute(Sender: TObject); 71 begin 72 FormAbout := TFormAbout.Create(nil); 73 try 74 FormAbout.ApplicationInfo := Core.ApplicationInfo1; 75 FormAbout.ShowModal; 76 finally 77 FreeAndNil(FormAbout); 78 end; 79 end; 80 81 procedure TCore.AExitExecute(Sender: TObject); 82 begin 83 FormMain.Close; 84 end; 85 86 procedure TCore.AGameNewExecute(Sender: TObject); 87 begin 88 FormNew := TFormNew.Create(nil); 89 try 90 FormNew.Load(Core.Game); 91 if FormNew.ShowModal = mrOk then begin 92 FormNew.Save(Core.Game); 93 Game.New; 94 end; 95 finally 96 FreeAndNil(FormNew); 97 end; 98 end; 99 51 100 procedure TCore.DataModuleDestroy(Sender: TObject); 52 101 begin … … 57 106 procedure TCore.GameChange(Sender: TObject); 58 107 begin 59 FormMain.Re paint;108 FormMain.Redraw; 60 109 end; 61 110 … … 67 116 68 117 Game.TopScore := ReadIntegerWithDefault('TopScore', 0); 118 Game.Size := Point(ReadIntegerWithDefault('SizeX', 4), ReadIntegerWithDefault('SizeY', 4)); 119 Game.AnimationDuration := ReadIntegerWithDefault('AnimationDuration', 30); 69 120 finally 70 121 Free; … … 79 130 80 131 WriteInteger('TopScore', Game.TopScore); 132 WriteInteger('SizeX', Game.Size.X); 133 WriteInteger('SizeY', Game.Size.Y); 134 WriteInteger('AnimationDuration', Game.AnimationDuration); 81 135 finally 82 136 Free;
Note:
See TracChangeset
for help on using the changeset viewer.