Changeset 46
- Timestamp:
- Nov 2, 2019, 12:22:07 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r40 r46 36 36 private 37 37 RedrawPending: Boolean; 38 KeyBuffer: array of Word; 38 39 public 39 40 procedure Redraw; … … 55 56 procedure TFormMain.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 56 57 begin 57 if Core.Game.Running and not Core.Game.Moving then begin 58 case Key of 59 37: Core.Game.MoveAllAndUpdate(drLeft, True); 60 38: Core.Game.MoveAllAndUpdate(drUp, True); 61 39: Core.Game.MoveAllAndUpdate(drRight, True); 62 40: Core.Game.MoveAllAndUpdate(drDown, True); 58 if Core.Game.Running then begin 59 SetLength(KeyBuffer, Length(KeyBuffer) + 1); 60 KeyBuffer[Length(KeyBuffer) - 1] := Key; 61 if not Core.Game.Moving then begin 62 while Length(KeyBuffer) > 0 do begin 63 case KeyBuffer[0] of 64 37: Core.Game.MoveAllAndUpdate(drLeft, True); 65 38: Core.Game.MoveAllAndUpdate(drUp, True); 66 39: Core.Game.MoveAllAndUpdate(drRight, True); 67 40: Core.Game.MoveAllAndUpdate(drDown, True); 68 end; 69 if Length(KeyBuffer) > 1 then 70 Move(KeyBuffer[1], KeyBuffer[0], (Length(KeyBuffer) - 1) * SizeOf(Word)); 71 SetLength(KeyBuffer, Length(KeyBuffer) - 1); 72 end; 73 end else begin 63 74 end; 64 75 end;
Note:
See TracChangeset
for help on using the changeset viewer.