Sha256: b2731dfe08f3544cdddec3e79983bac5cdd382d04cab4488a70409ef0af696fa

Contents?: true

Size: 575 Bytes

Versions: 5

Compression:

Stored size: 575 Bytes

Contents

#!/usr/bin/ruby -w

require "graphics"

class Radar < Graphics::Simulation
  CLEAR_COLOR = :darker_green

  def initialize
    super 640, 640

    register_color :darker_green,  0, 16,  0
    register_color :dark_green,   64, 96, 64
    register_color :dark_blue,     0,  0, 96
  end

  def draw n
    clear

    (0..640).step(64).each do |r|
      hline r, :dark_green
      vline r, :dark_green
      circle 320, 320, r, :dark_green unless r > 320
    end

    x, y, * = mouse
    line x, 0, x, 640, :white
    line 0, y, 640, y, :white

    fps n
  end
end

Radar.new.run

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
graphics-1.1.2 examples/radar.rb
graphics-1.1.1 examples/radar.rb
graphics-1.1.0 examples/radar.rb
graphics-1.0.1 examples/radar.rb
graphics-1.0.0 examples/radar.rb