Sha256: 0b7a48f5c4a871f8444654a8d91780b2244a40b5d7fb546908d08e55ca1d3dcf

Contents?: true

Size: 563 Bytes

Versions: 4

Compression:

Stored size: 563 Bytes

Contents

require 'ruby-processing'

class UsingSystemVariables < Processing::App

  def setup
    smooth
  end
  
  def draw
    background 100
    stroke 255
    
    # frame_count is used to color a rectangle
    fill(frame_count / 2)
    rect_mode CENTER
    
    # The rectangle will always be in the middle of the window
    # if it is located at (width/2, height/2)
    rect(width/2, height/2, mouse_x + 10, mouse_y + 10)
  end
  
  def key_pressed
    puts key
  end
  
end

UsingSystemVariables.new :title => "Using System Variables", :width => 200, :height => 200

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-processing-1.0.1 samples/learning_processing/chapter_04/5_using_system_variables.rb
ruby-processing-1.0.2 samples/learning_processing/chapter_04/5_using_system_variables.rb
ruby-processing-1.0.4 samples/learning_processing/chapter_04/5_using_system_variables.rb
ruby-processing-1.0.3 samples/learning_processing/chapter_04/5_using_system_variables.rb