Getting Started On Windows
Getting Started With JRubyArt
If you love to code because it is a creative process, then you should give JRubyArt a try because it can be used to create music, art, animations, videos and much more. Also since it is based on the latest Processing you can access a vast range of libraries to make the difficult things easier.
Why JRubyArt?
Since Processing already comes wrapped in an easy-to-use package, you may ask: “why should I bother with JRubyArt?”
The answer: if you know how to write Ruby, you can use Processing as a visual presentation layer of a much more complex program. Games, interactive art exhibits, innovative music projects, anything you can imagine; it’s all at your fingertips.
Additionally, you don’t have to declare types, voids, or understand the differences between floats and ints to get started, as you do in pure Processing.
Although there are some drawbacks to using the Ruby version Processing (slower start up time, and sometimes performance), having Ruby’s API available to translate your ideas into sketches more than makes up for them.
Setup
Setting JRubyArt since JRubyArt-2.0 does not require a vanilla processing install, but still requires some configuration to point to your libraries folder.
Install wget which is also available as cygwin package, openjdk (17.01+), and some version of ruby-2.6+ preferably jruby-9.3+. If you encounter linkage problems it might be worth looking at Eclipse Temurin distribution or OpenJ9.
JRuby
It might actually be simpler to just install jruby on Windows rather than struggle with MRI ruby, but you may also want to install cygwin or similar in any case (cygwin has a wget package).
If you’ve already installed MRI ruby is also possible to run JRubyArt without a system install of jruby. But a jruby install might be needed to use JRubyArt with other gems eg toxiclibs.
Possibly the simplest way to get MRI ruby on windows is via rubyinstaller, uses MinGW. Alternatively you can install cygwin and use rvm to install MRI ruby.
JRubyArt
Installing JRubyArt assumes you have installed a recent version of ruby (which can be either MRI ruby (preferably 2.5.* and not 2.7.* or safer JRuby-9.3.3.0)
gem install jruby_art
If you haven’t installed JRubyArt before, the simplest way to set the configuration, and to install samples is:-
k9 --install # no arguments
this also installs jruby-complete
If you have installed JRubyArt before, the simplest way to set the configuration is:-
k9 -if config
Using -f
or --force
flag forces the removal of the previous configuration.
To check your configuration:-
k9 --check # or -?
The config file is config.yml
in the ~/.jruby_art folder
, which you should edit if required.
To explore command line options:-
k9 --help # or k9 -h
Running examples
To explore the installed examples:-
cd ~/k9_samples
rake # to run examples randomly as a demo
# or check available tasks with
rake --tasks
# use a task to randomly run a group of sketches eg
rake shaders # runs the shader examples
Create your own sketches
To create a simple sketch:-
k9 -c fred 200 200 # sketch name=Fred width=200 height=200 mode=default
k9 -c my_sketch 300 300 p2d # sketch name=MySketch width=300 height=300 mode=P2D
Edit fred.rb
or my_sketch.rb
with your favourite editor preferably vim
, emacs
or atom
.
To run sketch using the command line
k9 -r fred.rb
To run a sketch from editor see editors
Read more about using the processing api here
Processing
Installing processing is optional but you could us it download the processing.org and contributed libraries. You can check to see what platforms are supported here.
Read more about using the processing api here