Results 1 to 2 of 2

Thread: draw a star!

  1. #1
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default draw a star!

    draws a lovely 5 point star.
    Simba Code:
    procedure TMufasaBitmap.hailSatan(p: TPoint; rad: integer);
    var
      i: integer;
      s, h, l, m, l2, m2: extended;
      pts: TPointArray;
      box: TBox;
    begin
      box := mainscreen.getBounds();
      box.shrink(rad);
      if (not p.isInBox(box)) then exit();
      self.drawCircle(p, rad, false, clRed);
      rad := round(rad*1.2);
      l := rad*sin(radians(18));
      m := rad*cos(radians(18));
      l2 := rad*sin(radians(36));
      m2 := rad*cos(radians(36));
      setLength(pts, 5);
      pts[0] := point(p.x, p.y+rad);
      pts[1] := point(round(p.x+l2), round(p.y-m2));
      pts[2] := point(round(p.x-m), round(p.y+l));
      pts[3] := point(round(p.x+m), round(p.y+l));
      pts[4] := point(round(p.x-l2), round(p.y-m2));
      for i := 0 to high(pts) do
       if (not pts[i].isInBox(mainscreen.getBounds())) then exit();
      self.drawPolygon(pts, clRed);
    end;
    it's a joke

  2. #2
    Join Date
    Mar 2015
    Posts
    189
    Mentioned
    3 Post(s)
    Quoted
    73 Post(s)

    Default

    It's a joke?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •