Changeset 14 for trunk/UCore.pas
- Timestamp:
- Mar 22, 2011, 6:35:54 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r13 r14 113 113 end; 114 114 115 { TKeyboard } 116 117 TKeyboard = class 118 KeyState: array[0..High(Word)] of Boolean; 119 procedure ClearAll; 120 end; 121 115 122 { TEngine } 116 123 … … 127 134 function IsInsideHouses(Pos: TPoint): Boolean; 128 135 public 129 Key State: array[0..High(Word)] of Boolean;136 Keyboard: TKeyboard; 130 137 World: TWorld; 131 138 Players: TObjectList; // <TPlayer> … … 166 173 TFastBitmapPixelComponents(Result).R := TFastBitmapPixelComponents(Value).B; 167 174 TFastBitmapPixelComponents(Result).B := TFastBitmapPixelComponents(Value).R; 175 end; 176 177 { TKeyboard } 178 179 procedure TKeyboard.ClearAll; 180 var 181 I: Integer; 182 begin 183 for I := 0 to High(KeyState) do 184 KeyState[I] := False; 168 185 end; 169 186 … … 318 335 Delta.X := 0; 319 336 Delta.Y := 0; 320 if Engine.Key State[Ord(Keys.Down)] then Delta.Y := Delta.Y + 1;321 if Engine.Key State[Ord(Keys.Up)] then Delta.Y := Delta.Y - 1;322 if Engine.Key State[Ord(Keys.Right)] then Delta.X := Delta.X + 1;323 if Engine.Key State[Ord(Keys.Left)] then Delta.X := Delta.X - 1;337 if Engine.KeyBoard.KeyState[Ord(Keys.Down)] then Delta.Y := Delta.Y + 1; 338 if Engine.KeyBoard.KeyState[Ord(Keys.Up)] then Delta.Y := Delta.Y - 1; 339 if Engine.KeyBoard.KeyState[Ord(Keys.Right)] then Delta.X := Delta.X + 1; 340 if Engine.KeyBoard.KeyState[Ord(Keys.Left)] then Delta.X := Delta.X - 1; 324 341 325 342 NewDirection := Direction; … … 348 365 end; 349 366 350 if Engine.Key State[Ord(Keys.Shoot)] then367 if Engine.KeyBoard.KeyState[Ord(Keys.Shoot)] then 351 368 if Bullets.Count < MaxBulletCount then begin 352 369 NewBullet := TBullet.Create; … … 533 550 Shield := 1; 534 551 PlaceHouse; 552 ShowTank; 535 553 end; 536 554 … … 756 774 IntfImage := TLazIntfImage.Create(1, 1); 757 775 Players := TObjectList.Create; 776 Keyboard := TKeyboard.Create; 758 777 World := TWorld.Create; 759 778 World.Engine := Self; … … 766 785 IntfImage.Free; 767 786 Players.Free; 787 Keyboard.Free; 768 788 World.Free; 769 789 inherited Destroy;
Note:
See TracChangeset
for help on using the changeset viewer.