-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Read platform requirements here
Before you start you might wish to install jruby on your system see here
Building and installing from the cloned repo unix:-
git clone https://github.com/monkstone/ruby-processing.git
cd ruby-processing
rake # This builds, and tests the ruby-processing-2.1.2.gem (external minitest is preferred)
jruby -S gem install ruby-processing-2.1.2.gem # to install locally may need sudo accessWindows user might prefer to use github for windows to clone repo, I’m not sure there is a rake for windows, so some terminal work will be required.
Alternatively there is a zipped source for latest release here. Simply unzip/untar the archive in your local directory and use rake as described previously.
Ruby-Processing provides you with the rp5 command, which is what you’ll use to run all the Ruby-Processing commands. Try typing rp5 --help to get a brief overview of the options. If you’re ready to try out an example, then let’s get started by unpacking the folder of samples so that you can examine and run them. Go to a folder where you’d like to store the samples, and type:
jruby -S rp5 unpack samples
jruby -S rp5 run samples/contributed/jwishy.rbAnd voilà.
See also examples from the Learning Processing book, check out Learning Processing with Ruby, and download the examples (however many of the sketches are in need of updating for processing-2.0).
Since the latest release bare sketches are preferred, although class wrapped sketches are still supported.
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.
def setup
size 800, 600
end
def draw
endjruby -S rp5 create my_sketch --p3d 800 600
def setup
size 800, 600, P3D
end
def draw
endGem install didn’t seem to create environment variable RP5_ROOT upon which ruby-processing depends. Adding this environment variable to the path of the gem seemed to do the trick. If you’re getting some errors where you don’t know whats going on this might be the issue.
