Static Sketches Improved Support
JRubyArt supports the concept of a static
sketch, where valid sketches could be a single lines of code. This is very similar to vanilla processing, however since JRubyArt-1.2.7 you can change the default sketch title and size via configuration ~/.jruby_art/config.yml
. You should delete any previous configuration to let our installer take a guess at your processing root:-
configuration
--- # config.yml
PROCESSING_ROOT: "/usr/share/processing" # Archlinux, adjust to your setup
JRUBY: true # set to false to use jruby-complete
sketchbook_path: "/home/tux/sketchbook3"
template: bare # class or emacs
MAX_WATCH: 40
sketch_title: 'JRubyArt Static Sketch'
width: 600
height: 600
creating and watching
a new sketch
For simplicities sake open a console and enter the following:-
mkdir my_sketch # so that we don't try to `watch` too many files
cd my_sketch
touch my_sketch.rb # create a blank file to work with
echo 'background 0' > my_sketch.rb
k9 -w my_sketch.rb
pseudo live edit the running sketch
Now from a new console (opening from console needed to pick up the local env
) we suggest using vim or atom, but other editors are available.
cd my_sketch
vim my_sketch.rb # excellent lightweight editor OR
atom my_sketch.rb # modern configurable editor, with support for JRubyArt
Edit the sketch as required and on save :w
vim (do not quit) or save Ctrl+S
atom the sketch will then reload. Repeat as required, the sketch won’t run with errors, but sketch should reload when corrected
.
classic hello world
background 0 # black gray scale
message = 'Hello World'
fill 200, 0, 0 # red color RGB
my_font = create_font('Georgia', 48)
text_font my_font # set current font
text_align(CENTER, CENTER) # align text to center
text message, (width / 2), (height / 2) # place text in sketch center
Read more about color here