class Vamp::Graphic::TextDotter
simple sample implementation for a graphic basic implementation
Public Instance Methods
clear()
click to toggle source
# File lib/vamp/graphic/text_dotter.rb, line 24 def clear @data = Array.new(height) { Array.new(width, " ") } self end
dot(x, y)
click to toggle source
Calls superclass method
Vamp::Graphic::Dotter#dot
# File lib/vamp/graphic/text_dotter.rb, line 7 def dot(x, y) super @data[y][x] = "X" self end
dot?(x, y)
click to toggle source
Calls superclass method
Vamp::Graphic::Dotter#dot?
# File lib/vamp/graphic/text_dotter.rb, line 13 def dot?(x, y) super @data[y][x] == "X" end
screen()
click to toggle source
# File lib/vamp/graphic/text_dotter.rb, line 29 def screen line = "+" + "-" * width + "+\n" line + @data.map { |x| "|#{x.join('')}|" }.join("\n").to_s + "\n" + line end
undot(x, y)
click to toggle source
Calls superclass method
Vamp::Graphic::Dotter#undot
# File lib/vamp/graphic/text_dotter.rb, line 18 def undot(x, y) super @data[y][x] = " " self end