Sha256: 7b2098d7c1bffea98373c6e7364a5a57c8fa15bb5e8107ff4e5823783dc89f2e

Contents?: true

Size: 603 Bytes

Versions: 3

Compression:

Stored size: 603 Bytes

Contents

#!/usr/bin/ruby -w

require "graphics"

class TargetSimulation < Graphics::Simulation
  def initialize
    super 640, 640, 16, "Target Practice"

    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 :darker_green

    (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

TargetSimulation.new.run

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
graphics-1.0.0b5 examples/radar.rb
graphics-1.0.0b4 examples/radar.rb
graphics-1.0.0b1 examples/radar.rb