5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/interactive.rb', line 5
def self.included(base)
base.class_eval do
alias :old_setup :setup
alias :old_draw :draw
def setup
old_setup
@cache = Cache.new(self).refresh
@index = @screen.build
end
def draw
old_draw
@screen.join = false
@old_points ||= []
@points_to_highlight ||= []
@cache.restore if @old_points.count > 0
@points_to_highlight.each do |p|
@highlight_block.call(p[:original], p[:mapped], @screen) if @highlight_block
@screen.draw_crosshairs(p[:original])
end
@old_points = @points_to_highlight
end
end
end
|