Changeset 2 for trunk/UFormMain.pas
- Timestamp:
- Dec 6, 2018, 10:58:45 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:ignore
set to
Game2048
Game2048.lps
lib
-
Property svn:ignore
set to
-
trunk/UFormMain.pas
r1 r2 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, UGame; 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus, 9 ActnList, UGame; 9 10 10 11 type … … 13 14 14 15 TFormMain = class(TForm) 16 AGameNew: TAction; 17 ActionList1: TActionList; 18 MainMenu1: TMainMenu; 19 MenuItem1: TMenuItem; 20 MenuItemGame: TMenuItem; 21 procedure AGameNewExecute(Sender: TObject); 22 procedure FormCreate(Sender: TObject); 23 procedure FormDestroy(Sender: TObject); 15 24 procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 16 25 procedure FormPaint(Sender: TObject); … … 29 38 30 39 {$R *.lfm} 40 41 uses 42 UFormNew; 31 43 32 44 { TFormMain } … … 50 62 end; 51 63 64 procedure TFormMain.AGameNewExecute(Sender: TObject); 65 begin 66 FormNew.Load(Game); 67 if FormNew.ShowModal = mrOk then begin 68 FormNew.Save(Game); 69 Game.New; 70 end; 71 end; 72 73 procedure TFormMain.FormCreate(Sender: TObject); 74 begin 75 Randomize; 76 Game := TGame.Create; 77 Game.Size := Point(4, 4); 78 Game.OnChange := GameChange; 79 end; 80 81 procedure TFormMain.FormDestroy(Sender: TObject); 82 begin 83 Game.Free; 84 end; 85 52 86 procedure TFormMain.FormPaint(Sender: TObject); 53 87 begin … … 57 91 procedure TFormMain.FormShow(Sender: TObject); 58 92 begin 59 Randomize;60 Game := TGame.Create;61 Game.Size := Point(3, 3);62 Game.OnChange := GameChange;63 93 Game.New; 64 65 94 { 66 95 Game.Cells[0, 0].Value := 1;
Note:
See TracChangeset
for help on using the changeset viewer.