Changeset 34 for trunk/UCore.pas
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 3 3 backup 4 4 tunneler.exe 5 tunneler.dbg 6 tunneler.lps 5 7 heaptrclog.trc 6 tunneler.lps 8 Components/Common/Languages/*.mo 9 Components/CoolTranslator/Demo/lib
-
- Property svn:ignore
-
trunk/UCore.pas
r32 r34 6 6 7 7 uses 8 Dialogs, Classes, SysUtils, Contnrs,Graphics, SpecializedMatrix, SpecializedList,8 Dialogs, Classes, SysUtils, Graphics, SpecializedMatrix, SpecializedList, 9 9 IntfGraphics, FPImage, LCLType, SpecializedBitmap, GraphType, Math, URectangle, 10 10 Syncobjs, UThreading, Forms, DateUtils, UAudioSystem, UAudioSystemMPlayer; … … 99 99 function DigProc(Item1, Item2: Byte): Byte; 100 100 public 101 Color: TColor; 101 102 Id: Integer; 102 103 Enabled: Boolean; … … 131 132 constructor Create; 132 133 destructor Destroy; override; 134 procedure Assign(Source: TPlayer); 133 135 property Exploded: Boolean read FExploded write SetExploded; 136 end; 137 138 { TPlayers } 139 140 TPlayers = class(TListObject) 141 procedure Assign(Players: TPlayers); 134 142 end; 135 143 … … 207 215 Keyboard: TKeyboard; 208 216 World: TWorld; 209 PlayerPool: T ListObject; // TListObject<TPlayer>210 Players: T ListObject; // TListObject<TPlayer>217 PlayerPool: TPlayers; // TListObject<TPlayer> 218 Players: TPlayers; // TListObject<TPlayer> 211 219 DigMasks: TListObject; // TListObject<TMatrixByte> 212 220 Lock: TCriticalSection; … … 215 223 AudioShot: TMediaPlayer; 216 224 AudioExplode: TMediaPlayer; 225 DrawDuration: TDatetime; 217 226 procedure CheckGameEnd; 218 227 constructor Create; … … 242 251 implementation 243 252 253 uses 254 UPlatform; 255 244 256 resourcestring 245 257 SPlayer = 'Player'; 258 246 259 247 260 … … 252 265 TFastBitmapPixelComponents(Result).R := TFastBitmapPixelComponents(Value).B; 253 266 TFastBitmapPixelComponents(Result).B := TFastBitmapPixelComponents(Value).R; 267 end; 268 269 { TPlayers } 270 271 procedure TPlayers.Assign(Players: TPlayers); 272 var 273 I: Integer; 274 begin 275 while Count < Players.Count do Add(TPlayer.Create); 276 while Count > Players.Count do Delete(Count - 1); 277 for I := 0 to Count - 1 do 278 TPlayer(Items[I]).Assign(TPlayer(Players[I])); 254 279 end; 255 280 … … 708 733 var 709 734 Delta: TPoint; 710 Matter: TMatterIndex;711 735 NewBullet: TBullet; 712 I: Integer;713 Pos: TPoint;714 ColisionState: TColisionState;715 736 begin 716 737 if Exploded then Exit; … … 815 836 P: Integer; 816 837 Pos: TPoint; 817 D: Real;818 838 begin 819 839 // Check energy … … 1181 1201 end; 1182 1202 1203 procedure TPlayer.Assign(Source: TPlayer); 1204 begin 1205 Keys := Source.Keys; 1206 Color := Source.Color; 1207 Energy := Source.Energy; 1208 Shield := Source.Shield; 1209 Name := Source.Name; 1210 Enabled := Source.Enabled; 1211 Position := Source.Position; 1212 Score := Source.Score; 1213 end; 1214 1183 1215 { TEngine } 1184 1216 … … 1230 1262 procedure TEngine.DoDrawToBitmap; 1231 1263 var 1232 I: Integer;1233 1264 X, Y: Integer; 1234 1265 PixelX, PixelY: Integer; … … 1328 1359 NewMask: TMatrixByte; 1329 1360 I: Integer; 1330 X, Y: Integer;1331 1361 begin 1332 1362 DigMasks.Clear; … … 1542 1572 FBitmapLock := TCriticalSection.Create; 1543 1573 IntfImage := TLazIntfImage.Create(1, 1); 1544 PlayerPool := T ListObject.Create;1545 Players := T ListObject.Create;1574 PlayerPool := TPlayers.Create; 1575 Players := TPlayers.Create; 1546 1576 Players.OwnsObjects := False; 1547 1577 Keyboard := TKeyboard.Create; 1548 1578 World := TWorld.Create; 1549 1579 World.Engine := Self; 1550 DefaultAudioSystem := TAudioSystemMPlayer.Create(nil);1580 //DefaultAudioSystem := TAudioSystemMPlayer.Create(nil); 1551 1581 AudioShot := TMediaPlayer.Create(nil); 1552 1582 AudioShot.FileName := 'Audio/GE_KF7_Soviet.wav'; … … 1597 1627 var 1598 1628 I: Integer; 1599 begin 1600 if FRedrawPending then 1601 begin 1629 DrawStart: TDateTime; 1630 begin 1631 if FRedrawPending then begin 1632 DrawStart := NowPrecise; 1602 1633 FRedrawPending := False; 1603 1634 try … … 1611 1642 end; 1612 1643 if not Thread.Terminated then Thread.Synchronize(DoDrawToBitmap); 1644 DrawDuration := NowPrecise - DrawStart; 1613 1645 end; 1614 1646 end; … … 1617 1649 var 1618 1650 I: Integer; 1619 I2: Integer;1620 1651 begin 1621 1652 Active := False;
Note:
See TracChangeset
for help on using the changeset viewer.