Class: TuioClient
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ TuioClient
constructor
A new instance of TuioClient.
- #start ⇒ Object
- #tuio_cursor(id) ⇒ Object
- #tuio_cursors ⇒ Object
- #tuio_object(id) ⇒ Object
-
#tuio_objects ⇒ Object
getters #.
Constructor Details
#initialize(args = {}) ⇒ TuioClient
Returns a new instance of TuioClient.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/tuio_client.rb', line 15 def initialize( args = {} ) @port = args[:port] || 3333 @tuio_objects = { } @tuio_cursors = { } @osc = OSC::SimpleServer.new(@port) @osc.add_method '/tuio/2Dobj' do |msg| args = msg.to_a case args.shift when "set" track_tuio_object( args ) when "alive" keep_alive( :tuio_objects, args ) when "fseq" # puts args end end @osc.add_method '/tuio/2Dcur' do |msg| args = msg.to_a case args.shift when "set" track_tuio_cursor args when "alive" keep_alive( :tuio_cursors, args ) when "fseq" # puts args end end end |
Instance Method Details
#start ⇒ Object
50 51 52 53 54 |
# File 'lib/tuio_client.rb', line 50 def start Thread.new do @osc.run end end |
#tuio_cursor(id) ⇒ Object
72 73 74 |
# File 'lib/tuio_client.rb', line 72 def tuio_cursor( id ) @tuio_cursors[id] end |
#tuio_cursors ⇒ Object
68 69 70 |
# File 'lib/tuio_client.rb', line 68 def tuio_cursors @tuio_cursors end |
#tuio_object(id) ⇒ Object
64 65 66 |
# File 'lib/tuio_client.rb', line 64 def tuio_object( id ) @tuio_objects[id] end |
#tuio_objects ⇒ Object
getters #
60 61 62 |
# File 'lib/tuio_client.rb', line 60 def tuio_objects @tuio_objects end |