Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0

Wednesday, 20 May 2015

Bleeding Edge Stuff With Processing-3.0a9

What a JRubyArt sketch might look like with processing-3.0a9, to set title need to set title of surface (which is a protected field), we make this easy by introducing a 'sketch_title' method that does the clever stuff under the hood. Also note size has moved out of setup to settings method (processing does this for you so you don't see it with vanilla processing). Looking good so far with modified 'trefoil' sketch also monjori' shader (latter requires 'k9 run monjori.rb' as expected), all running with jruby- NB without setting a title get some crazy default title like 'org.jruby.proxy.processing.core.PApplet$Proxy1'.
require 'jruby_art'

class Fred < Processing::AppGL
  def setup
    sketch_title 'Fred' # uses surface.setTitle

  def draw
    background 0
    fill 200, 0, 0
    translate 150, 150
    rotate_x 0.01 * frame_count
    rotate_y 0.02 * frame_count
    box(90, 90, 90)

  def settings
    size 300, 300, P3D
# currently can't set sketch title this way use setup method
Fred.new(title: 'Fred')

No comments:

Post a Comment


Blog Archive

About Me

My photo
I have developed JRubyArt and propane new versions of ruby-processing for JRuby- and processing-3.2.2