close Warning: Can't synchronize with repository "(default)" (No changeset 184 in the repository). Look in the Trac log for more information.

Changeset 151 for trunk/UGame.pas


Ignore:
Timestamp:
Nov 14, 2017, 11:11:57 PM (6 years ago)
Author:
chronos
Message:
  • Added: Map can have rounded shape.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGame.pas

    r149 r151  
    150150  end;
    151151
    152   TMapShape = (msRectangle, msImage);
     152  TMapShape = (msRectangle, msImage, msRounded);
    153153
    154154  { TMapArea }
     
    12691269  Color: TColor;
    12701270  Pos: TPoint;
     1271  Center: TPoint;
    12711272begin
    12721273  case Shape of
     
    12811282      Result := Color <> clWhite;
    12821283    end;
     1284    msRounded: begin
     1285      Rect := GetPixelRect;
     1286      Center := Point(Rect.Left + Rect.Width div 2, Rect.Top + Rect.Height div 2);
     1287      Result := Sqr(Coord.X - Center.X) / Sqr(Rect.Width div 2) +
     1288        Sqr(Coord.Y - Center.Y) / Sqr(Rect.Height div 2) > 1;
     1289    end
    12831290    else Result := False;
    12841291  end;
Note: See TracChangeset for help on using the changeset viewer.