0.0
No commit activity in last 3 years
No release in over 3 years
A server that allows multiple users to view and program a shared Ruby-Processing sketch.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0

Runtime

 Project Readme

AMQP-Processing

Ruby-Processing, Internet-enabled.

OS X, Windows, and Linux machines, all displaying the same sketch via amqp-processing

Installation

Install JRuby, if you haven’t done so already. This is most easily done with rvm :

  $ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
  $ rvm install jruby

Then switch to your JRuby environment, and install the AMQP-Processing gem:

  $ rvm use jruby
  $ gem install amqp-processing

Connecting to a Server

Once installation is complete, the “amqpp” executable should be available in your $PATH. Run it like so:

  $ amqpp <server_address>

Where server_address is the address of an AMQP server (like RabbitMQ). You can provide a port number as a second argument if the server isn’t using the standard AMQP port (5672).

Drawing

When the prompt appears, call Processing::App methods on the proxy object stored in $client. The call will be duplicated on all clients currently connected to the server.

  >> $client.stroke 100, 255, 50, 128
  => nil
  >> $client.oval 100, 100, 300, 200
  => nil

Here are a few basic method calls:

  #Draw an opaque yellow line around shapes, 10 pixels wide.
  red, green, blue, alpha = 128, 128, 0, 255
  $client.stroke(red, green, blue, alpha)
  $client.stroke_width 10
  #Fill shapes with semi-transparent purple.
  red, green, blue, alpha = 255, 0, 255, 128
  $client.fill(red, green, blue, alpha)
  #Draw shapes.
  x, y = 200, 100
  width, height = 400, 300
  $client.rect(x, y, width, height)
  $client.oval(x, y, width, height)

You can find more examples to get you started here:

Samples from the Ruby-Processing project

The full Processing API is supported; you can read up on the various methods here:

API reference at processing.org

You can call your local Processing::App directly (without sending the call to other clients) via $client.app. In this example, oval() would be sent over the wire, but mouse_x() and mouse_y() would not:

  loop do
    x = $client.app.mouse_x
    y = $client.app.mouse_y
    $client.oval(x, y, 100, 100)
  end

If you don’t want to prepend “$client” to everything, you can switch to the client’s context in IRB:

  >> irb $client        
  >> oval 99, 99, 99, 99

Copyright

Copyright © 2010-2011 Jay McGavren. Released under the MIT license. See the LICENSE file for details.