Changeset 20 for trunk/Forms
- Timestamp:
- Oct 5, 2019, 2:00:50 PM (5 years ago)
- Location:
- trunk/Forms
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r11 r20 20 20 Caption = 'Game' 21 21 object MenuItemNew: TMenuItem 22 Action = Core.AGameNew 22 Action = Core.ANew 23 end 24 object MenuItem2: TMenuItem 25 Action = Core.AUndo 23 26 end 24 27 object MenuItem1: TMenuItem -
trunk/Forms/UFormMain.pas
r19 r20 16 16 MainMenu1: TMainMenu; 17 17 MenuItem1: TMenuItem; 18 MenuItem2: TMenuItem; 18 19 MenuItemNew: TMenuItem; 19 20 MenuItemExit: TMenuItem; … … 48 49 49 50 procedure TFormMain.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 50 var51 MovedCount: Integer;52 51 begin 53 52 if Core.Game.Running and not Core.Game.Moving then begin 54 MovedCount := 0;55 53 case Key of 56 37: MovedCount :=Core.Game.MoveAll(drLeft);57 38: MovedCount :=Core.Game.MoveAll(drUp);58 39: MovedCount :=Core.Game.MoveAll(drRight);59 40: MovedCount :=Core.Game.MoveAll(drDown);54 37: Core.Game.MoveAll(drLeft); 55 38: Core.Game.MoveAll(drUp); 56 39: Core.Game.MoveAll(drRight); 57 40: Core.Game.MoveAll(drDown); 60 58 end; 61 if MovedCount > 0 then Core.Game.FillRandomTile;62 if not Core.Game.CanMove and (Core.Game.Board.GetEmptyTilesCount = 0) then63 Core.Game.GameOver;64 if (not Core.Game.Won) and (Core.Game.Board.GetHighestTileValue >= 2048) then65 Core.Game.Win;66 59 end; 67 60 end; -
trunk/Forms/UFormNew.lfm
r15 r20 25 25 ItemHeight = 0 26 26 Items.Strings = ( 27 '2 x 2' 27 28 '3 x 3' 28 29 '4 x 4' -
trunk/Forms/UFormNew.pas
r17 r20 45 45 procedure TFormNew.Load(Game: TGame); 46 46 begin 47 ComboBoxSize.ItemIndex := Game.Board.Size.X - 3;47 ComboBoxSize.ItemIndex := Game.Board.Size.X - 2; 48 48 end; 49 49 50 50 procedure TFormNew.Save(Game: TGame); 51 51 begin 52 Game.Board.Size := Point( 3 + ComboBoxSize.ItemIndex, 3+ ComboBoxSize.ItemIndex);52 Game.Board.Size := Point(2 + ComboBoxSize.ItemIndex, 2 + ComboBoxSize.ItemIndex); 53 53 end; 54 54
Note:
See TracChangeset
for help on using the changeset viewer.