Skip to content

Instantly share code, notes, and snippets.

@baroquebobcat
Forked from jaymcgavren/server.rb
Created October 20, 2010 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baroquebobcat/636680 to your computer and use it in GitHub Desktop.
Save baroquebobcat/636680 to your computer and use it in GitHub Desktop.
#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
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)
@ultrasaurus
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment