Changeset 49 for branches/paintbox/UEngine.pas
- Timestamp:
- Aug 22, 2019, 9:50:21 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/paintbox/UEngine.pas
r45 r49 219 219 FBitmapLock: TCriticalSection; 220 220 FOnGameEnd: TNotifyEvent; 221 FOnRepaint: TNotifyEvent; 221 222 FRedrawPending: Boolean; 222 223 FBitmapLower: TBitmapTColor; … … 230 231 function IsInsideHouses(Pos: TPoint): Boolean; 231 232 procedure DoDrawToBitmap; 233 procedure DoOnRepaint; 232 234 procedure InitPlayerPool; 233 235 procedure InitPlayers; … … 257 259 property Active: Boolean read FActive write SetActive; 258 260 property OnGameEnd: TNotifyEvent read FOnGameEnd write FOnGameEnd; 261 property OnRepaint: TNotifyEvent read FOnRepaint write FOnRepaint; 259 262 end; 260 263 … … 370 373 repeat 371 374 Engine.Draw(Self); 372 Sleep(50);375 //Sleep(50); 373 376 until Terminated; 374 377 end; … … 1154 1157 begin 1155 1158 FBitmap := AValue; 1156 ResizePlayerFrames;1157 1159 end; 1158 1160 … … 1271 1273 end; 1272 1274 1275 procedure TEngine.DoOnRepaint; 1276 begin 1277 if Assigned(FOnRepaint) then FOnRepaint(Self); 1278 end; 1279 1273 1280 procedure TEngine.InitDigMasks; 1274 1281 var … … 1520 1527 constructor TEngine.Create; 1521 1528 begin 1529 FBitmap := TBitmap.Create; 1522 1530 Lock := TCriticalSection.Create; 1523 1531 FBitmapLower := TBitmapTColor.Create; … … 1557 1565 FreeAndNil(AudioShot); 1558 1566 FreeAndNil(AudioExplode); 1567 FreeAndNil(FBitmap); 1559 1568 inherited Destroy; 1560 1569 end; … … 1593 1602 Lock.Release; 1594 1603 end; 1595 if not Thread.Terminated then Thread.Synchronize(DoDrawToBitmap); 1604 if not Thread.Terminated then DoDrawToBitmap; 1605 if not Thread.Terminated then Thread.Synchronize(DoOnRepaint); 1596 1606 DrawDuration := NowPrecise - DrawStart; 1597 1607 end;
Note:
See TracChangeset
for help on using the changeset viewer.