Making Your Own
Because every sketch has a setup
method, called once at the start, and a draw
method, called continuously as it animates; Ruby-Processing includes a sketch creator to get you started on the right foot with the proper (minimal) boilerplate. Using rp5 create my_sketch 800 600
, will generate a Processing::App that’s 800 by 600 pixels in size, and just displays a blank window. The generated my_sketch.rb
will look like:
require 'ruby-processing'
class MySketch < Processing::App
def setup
end
def draw
end
end
MySketch.new :title => "My Sketch", :width => 800, :height => 600