-
-
Save baroquebobcat/636680 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#start this first | |
require 'rinda/ring' | |
require 'rinda/tuplespace' | |
DRb.start_service | |
# Create a TupleSpace to hold named services, and start running | |
Rinda::RingServer.new Rinda::TupleSpace.new | |
# Wait until the user explicitly kills the server. | |
DRb.thread.join |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sketch < Processing::App | |
def setup | |
render_mode P3D | |
require 'rinda/ring' | |
require 'drb' | |
class <<self | |
attr_accessor :fade | |
%w{ | |
clone | |
define_singleton_method | |
display | |
dup | |
extend | |
freeze | |
instance_eval | |
instance_exec | |
instance_variable_defined? | |
instance_variable_get | |
instance_variable_set | |
instance_variables | |
public_send | |
remove_instance_variable | |
send | |
tap | |
library_loaded? | |
load_java_library | |
load_libraries | |
load_library | |
load_ruby_library | |
}.each do |method| | |
if method_defined?(method.to_sym) | |
undef_method(method.to_sym) | |
end | |
end | |
end | |
background 100 | |
self.fade = false | |
DRb.start_service | |
provider = Rinda::RingProvider.new :processing, self, 'DRB Processing' | |
provider.provide | |
end | |
def draw | |
if fade | |
fill 0, 0, 0, 4 | |
rect_mode CORNER | |
rect 0, 0, width, height | |
end | |
end | |
end | |
Sketch.new(:width => 1080, :height => 768, :title => 'http://gist.github.com/636680', :full_screen => false) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
client-side
http://gist.github.com/636681
http://tinyurl.com/learn-ruby-processing
require 'rinda/ring'
DRb.start_service
ring_server = Rinda::RingFinger.primary
processing = ring_server.read([:name,:processing,nil,nil])[2]
o = processing
o.stroke 255, 0, 0 #Red outline
o.fill 0, 0, 255 #Blue center
o.ellipse 100, 50, 200, 400 #Tall oval
o.rect 350, 100, 400, 200 #Wide rectangle
o.line 0, 0, o.width, o.height #line across