Changeset 52 for trunk/UEngine.pas


Ignore:
Timestamp:
Dec 20, 2021, 7:47:26 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Renamed forms to start their name with Form prefix.
  • Fixed: Drawing game scene.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UEngine.pas

    r51 r52  
    823823begin
    824824  with Engine.FBitmapLower do begin
    825     //Brush.Color := SurfaceMatterColors[smRock];
    826     //FillRect(ScreenFrame);
    827     for Y := ScreenFrame.Top to ScreenFrame.Bottom - 1 do
    828       for X := ScreenFrame.Left to ScreenFrame.Right - 1 do begin
    829         ItemsXY[X, Y] := 0;
    830       end;
    831 
    832825    Fill(CreateIndex(ScreenFrame.Left, ScreenFrame.Top),
    833826      CreateIndex(ScreenFrame.Width, ScreenFrame.Height),
    834827      Engine.World.Matters[Integer(miRock)].Color);
    835 
    836828
    837829    with Engine.World do
     
    861853    for I := ScreenFrame.Left to ScreenFrame.Right - 1 do
    862854      ItemsXY[I, 0] := $010101 * I;
    863 
    864       for Y := ScreenFrame.Top to ScreenFrame.Bottom - 1 do
    865       for X := ScreenFrame.Left to ScreenFrame.Right - 1 do begin
    866         ItemsXY[X, Y] := 0;
    867       end;
    868855  end;
    869856end;
     
    12101197  BgColor: Cardinal;
    12111198begin
    1212   if Assigned(FBitmap) then
     1199  if Assigned(FBitmap) then begin
     1200  Lock.Acquire;
     1201  Bitmap.BeginUpdate;
    12131202  try
    1214     Lock.Acquire;
    1215     Bitmap.BeginUpdate;
    12161203    {$IFDEF WINDOWS}
    12171204    Bitmap.PixelFormat := pf32bit;
     
    12211208    BytePerRow := RawImage.Description.BytesPerLine;
    12221209    if ClearBackground then begin
    1223       BgColor := TMatter(World.Matters[Integer(miBorder)]).Color;
     1210      BgColor := World.Matters[Integer(miBorder)].Color;
    12241211      BgColor := SwapBRComponent(BgColor);
    12251212      FillDWord(RawImage.Data^, Bitmap.Height * BytePerRow div 4, BgColor);
     
    12811268    end;
    12821269  finally
    1283     FBitmap.EndUpdate;
     1270    Bitmap.EndUpdate;
    12841271    Lock.Release;
     1272  end;
    12851273  end;
    12861274end;
     
    15941582  I: Integer;
    15951583  DrawStart: TDateTime;
     1584  OldCount: TBitmapTColorIndex;
    15961585begin
    15971586  if FRedrawPending then begin
     
    16001589    Lock.Acquire;
    16011590    try
    1602       //if ClearBackground then FBitmapLower.FillAll(clNavy);
     1591      // TODO: Without this (re)initialization we get range error
     1592      OldCount := FBitmapLower.Count;
     1593      FBitmapLower.Count := FBitmapLower.CreateIndex(0, 0);
     1594      FBitmapLower.Count := OldCount;
     1595
     1596      if ClearBackground then FBitmapLower.FillAll(clNavy);
    16031597      for I := 0 to Players.Count - 1 do
    16041598      if Players[I].Enabled then begin
Note: See TracChangeset for help on using the changeset viewer.