- Timestamp:
- Dec 6, 2018, 10:58:45 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:ignore
set to
Game2048
Game2048.lps
lib
-
Property svn:ignore
set to
-
trunk/Game2048.lpi
r1 r2 9 9 <ResourceType Value="res"/> 10 10 <UseXPManifest Value="True"/> 11 <XPManifest> 12 <DpiAware Value="True"/> 13 </XPManifest> 11 14 <Icon Value="0"/> 12 15 </General> … … 27 30 </Item1> 28 31 </RequiredPackages> 29 <Units Count=" 3">32 <Units Count="4"> 30 33 <Unit0> 31 34 <Filename Value="Game2048.lpr"/> … … 43 46 <IsPartOfProject Value="True"/> 44 47 </Unit2> 48 <Unit3> 49 <Filename Value="UFormNew.pas"/> 50 <IsPartOfProject Value="True"/> 51 <ComponentName Value="FormNew"/> 52 <ResourceBaseClass Value="Form"/> 53 </Unit3> 45 54 </Units> 46 55 </ProjectOptions> -
trunk/Game2048.lpr
r1 r2 8 8 {$ENDIF}{$ENDIF} 9 9 Interfaces, // this includes the LCL widgetset 10 Forms, UFormMain, UGame 10 Forms, UFormMain, UGame, UFormNew 11 11 { you can add units after this }; 12 12 … … 17 17 Application.Initialize; 18 18 Application.CreateForm(TFormMain, FormMain); 19 Application.CreateForm(TFormNew, FormNew); 19 20 Application.Run; 20 21 end. -
trunk/UFormMain.lfm
r1 r2 6 6 Caption = '2048 game' 7 7 DesignTimePPI = 144 8 Menu = MainMenu1 9 OnCreate = FormCreate 10 OnDestroy = FormDestroy 8 11 OnKeyUp = FormKeyUp 9 12 OnPaint = FormPaint 10 13 OnShow = FormShow 11 14 LCLVersion = '1.8.4.0' 15 object MainMenu1: TMainMenu 16 left = 325 17 top = 152 18 object MenuItemGame: TMenuItem 19 Caption = 'Game' 20 object MenuItem1: TMenuItem 21 Action = AGameNew 22 end 23 end 24 end 25 object ActionList1: TActionList 26 left = 144 27 top = 155 28 object AGameNew: TAction 29 Caption = 'New...' 30 OnExecute = AGameNewExecute 31 end 32 end 12 33 end -
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.