Module: DrawGrid

Defined in:
lib/graphics/decorators.rb

Overview

Include this in your simulation and define GRID_WIDTH to draw a grid in the window.

Instance Method Summary collapse

Instance Method Details

#pre_draw(n) ⇒ Object

:nodoc:



17
18
19
20
21
22
23
24
# File 'lib/graphics/decorators.rb', line 17

def pre_draw n # :nodoc:
  super

  (0...w).step(self.class::GRID_WIDTH).each do |x|
    hline x, :gray
    vline x, :gray
  end
end