Sha256: ec9a9c50f13ebf5e8c783168270e664a2bdc567ef8f169438a901a72d27c9452

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

# So, let's get started: The first thing you may notice is
# that there is a bunch more code around the edges here 
# than in the Learning Processing example. Ruby-Processing
# doesn't perform any special munging or pre-processing, 
# so what you see here is *just Ruby* taking advantage
# of the Processing library.

# Hence, this line, which loads in Processing.
require 'ruby-processing'

# Here we begin to define the Sketch by making it a 
# Processing App.
class StrokeAndFill < Processing::App

  # Now we define a setup method, for code that gets
  # run one time when the app is started.
  def setup
    background 255
    stroke 0
    fill 150
    rect 50, 50, 75, 100    
  end
  
  # And the draw method has nothing inside of it.
  # If it did, the code inside would be run repeatedly.
  def draw
  
  end
  
end

# Now that the sketch is defined, we can start one up.
# The following line does this, passing in the title, width, and height.
StrokeAndFill.new :title => "Stroke And Fill", :width => 200, :height => 200

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-processing-1.0.1 samples/learning_processing/chapter_01/1_stroke_and_fill.rb
ruby-processing-1.0.2 samples/learning_processing/chapter_01/1_stroke_and_fill.rb
ruby-processing-1.0.3 samples/learning_processing/chapter_01/1_stroke_and_fill.rb