Sha256: 4cdedc96261246c038a921db6a45d969386869ec5eacd64c508d3c5aa463e14a

Contents?: true

Size: 554 Bytes

Versions: 1

Compression:

Stored size: 554 Bytes

Contents

module Gosu
  def self.draw_circle(x, y, z, radius, color = Gosu::Color::WHITE, step_size = 36)
    step_size = (360.0/step_size).floor

    0.step(359, step_size) do |angle|
      angle2 = angle + step_size

      point_lx = x + Gosu.offset_x(angle, radius)
      point_ly = y + Gosu.offset_y(angle, radius)
      point_rx = x + Gosu.offset_x(angle2, radius)
      point_ry = y + Gosu.offset_y(angle2, radius)

      Gosu.draw_triangle(
        point_lx, point_ly, color,
	      point_rx, point_ry, color,
	      x, y, color, z
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gosu_more_drawables-0.1.0 lib/gosu_more_drawables/draw_circle.rb