class BLF::Block
Attributes
end_x[RW]
end_y[RW]
height[RW]
start_x[RW]
start_y[RW]
width[RW]
world[RW]
Public Class Methods
new(args)
click to toggle source
# File lib/blf/block.rb, line 8 def initialize(args) @start_x = args[:start_x] || 0 @start_y = args[:start_y] || 0 @width = args[:width] || 0 @height = args[:height] || 0 @world = args[:world] end
Public Instance Methods
draw()
click to toggle source
# File lib/blf/block.rb, line 24 def draw dr = Draw.new dr.stroke = "#ccddff" dr.fill = "rgb(#{random*255}, #{random*255}, #{random*255})" dr.stroke_width 1 dr.rectangle @start_x, @start_y, end_x, end_y dr.draw @world.image end
random()
click to toggle source
# File lib/blf/block.rb, line 33 def random Random.new(Random.new_seed).rand end