tuio-ruby 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +33 -8
- data/Rakefile +3 -3
- data/lib/tuio-ruby/tuio_client.rb +2 -2
- data/spec/spec_helper.rb +8 -11
- metadata +6 -5
- data/spec/unit/tuio_container_spec.rb +0 -74
data/README.rdoc
CHANGED
@@ -2,19 +2,44 @@
|
|
2
2
|
|
3
3
|
http://www.tuio.org/
|
4
4
|
|
5
|
-
== REQUIREMENTS:
|
6
|
-
|
7
|
-
You will need the OSC gem
|
8
|
-
|
9
|
-
[sudo] gem install osc
|
10
|
-
|
11
5
|
== INSTALL:
|
12
6
|
|
13
|
-
[sudo] gem install
|
7
|
+
[sudo] gem install tuio-ruby
|
14
8
|
|
15
9
|
== EXAMPLE:
|
16
10
|
|
17
|
-
|
11
|
+
require File.join( File.dirname( __FILE__ ), '..', 'lib', 'tuio-ruby' )
|
12
|
+
|
13
|
+
|
14
|
+
@tc = TuioClient.new
|
15
|
+
|
16
|
+
@tc.on_object_creation do | to |
|
17
|
+
puts "New TUIO Object at x: #{to.x_pos}, y: #{to.y_pos}"
|
18
|
+
end
|
19
|
+
|
20
|
+
@tc.on_object_update do | to |
|
21
|
+
puts "Updated TUIO Object #{to.fiducial_id} at x: #{to.x_pos}, y: #{to.y_pos}"
|
22
|
+
end
|
23
|
+
|
24
|
+
@tc.on_object_removal do | to |
|
25
|
+
puts "Removed TUIO Object #{to.fiducial_id}"
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
@tc.on_cursor_creation do | to |
|
30
|
+
puts "New TUIO Cursor at x: #{to.x_pos}, y: #{to.y_pos}"
|
31
|
+
end
|
32
|
+
|
33
|
+
@tc.on_cursor_update do | to |
|
34
|
+
puts "Updated TUIO Cursor #{to.session_id} at x: #{to.x_pos}, y: #{to.y_pos}"
|
35
|
+
end
|
36
|
+
|
37
|
+
@tc.on_cursor_removal do | to |
|
38
|
+
puts "Removed TUIO Cursor #{to.session_id}"
|
39
|
+
end
|
40
|
+
|
41
|
+
@tc.start
|
42
|
+
sleep
|
18
43
|
|
19
44
|
== COPYRIGHT:
|
20
45
|
|
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ task :default => :spec
|
|
6
6
|
Spec::Rake::SpecTask.new do |t|
|
7
7
|
t.warning = false
|
8
8
|
t.rcov = false
|
9
|
-
t.spec_opts = ["--colour"]
|
9
|
+
t.spec_opts = ["--colour"]
|
10
10
|
end
|
11
11
|
|
12
12
|
require 'rake/rdoctask'
|
@@ -35,10 +35,10 @@ begin
|
|
35
35
|
gem.test_files = FileList['spec/**/*.rb']
|
36
36
|
gem.add_dependency('osc-ruby', '>= 0.1.6')
|
37
37
|
gem.rubyforge_project = "tuio-ruby"
|
38
|
-
|
38
|
+
|
39
39
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
Jeweler::RubyforgeTasks.new do |rubyforge|
|
43
43
|
rubyforge.doc_task = "rdoc"
|
44
44
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'spec'
|
3
|
-
require '
|
4
|
-
require 'osc'
|
3
|
+
require 'osc-ruby'
|
5
4
|
|
6
5
|
$: << File.join( File.dirname( __FILE__ ), '..', 'lib' )
|
7
6
|
|
8
|
-
require 'tuio-ruby'
|
9
|
-
|
10
|
-
Spec::Runner.configure do |config|
|
11
|
-
config.mock_with RR::Adapters::Rspec
|
12
|
-
end
|
7
|
+
require 'tuio-ruby'
|
13
8
|
|
14
9
|
# monkey patch to get at osc core to send messages
|
15
10
|
class TuioClient
|
@@ -21,16 +16,18 @@ end
|
|
21
16
|
# helper method for integration tests
|
22
17
|
def send_message( pattern, *msg )
|
23
18
|
osc_msg = OSC::Message.new( pattern, nil, *msg)
|
24
|
-
|
19
|
+
|
25
20
|
@server.osc.send( :sendmesg, osc_msg )
|
26
21
|
end
|
27
22
|
|
28
23
|
def setup_server
|
29
|
-
mock( socket
|
24
|
+
socket = mock( "socket" )
|
30
25
|
|
31
26
|
# stub out networking
|
32
|
-
stub(
|
33
|
-
|
27
|
+
socket.stub!(:bind).with("", 3333)
|
28
|
+
|
29
|
+
UDPSocket.stub!(:new).and_return( socket )
|
34
30
|
|
31
|
+
# UDPSocket.new.bind( "", 3333 )
|
35
32
|
@server = TuioClient.new
|
36
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tuio-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aberant
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-14 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -49,6 +49,8 @@ files:
|
|
49
49
|
- README.rdoc
|
50
50
|
has_rdoc: true
|
51
51
|
homepage: http://github.com/aberant/tuio-ruby
|
52
|
+
licenses: []
|
53
|
+
|
52
54
|
post_install_message:
|
53
55
|
rdoc_options:
|
54
56
|
- --charset=UTF-8
|
@@ -69,14 +71,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
71
|
requirements: []
|
70
72
|
|
71
73
|
rubyforge_project: tuio-ruby
|
72
|
-
rubygems_version: 1.3.
|
74
|
+
rubygems_version: 1.3.5
|
73
75
|
signing_key:
|
74
|
-
specification_version:
|
76
|
+
specification_version: 3
|
75
77
|
summary: library to interface with TUIO protocol
|
76
78
|
test_files:
|
77
79
|
- spec/integration/tuio_event_spec.rb
|
78
80
|
- spec/spec_helper.rb
|
79
|
-
- spec/unit/tuio_container_spec.rb
|
80
81
|
- spec/unit/tuio_cursor_parameter_spec.rb
|
81
82
|
- spec/unit/tuio_cursor_spec.rb
|
82
83
|
- spec/unit/tuio_object_parameter_spec.rb
|
@@ -1,74 +0,0 @@
|
|
1
|
-
# require File.join( File.dirname(__FILE__) , '..', 'spec_helper' )
|
2
|
-
#
|
3
|
-
# class TuioContainer
|
4
|
-
# # we want to be able to instantiate this class for testing
|
5
|
-
# def self.abstract?
|
6
|
-
# false
|
7
|
-
# end
|
8
|
-
# end
|
9
|
-
#
|
10
|
-
# describe TuioContainer do
|
11
|
-
# before :each do
|
12
|
-
# @session_id = 42
|
13
|
-
# @x_pos = 0.8
|
14
|
-
# @y_pos = 0.3
|
15
|
-
# @tc = TuioContainer.new( @session_id, @x_pos, @y_pos )
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# describe "in general" do
|
19
|
-
# it "should know it's session id" do
|
20
|
-
# @tc.session_id.should == @session_id
|
21
|
-
# end
|
22
|
-
#
|
23
|
-
# it "should know it's x position" do
|
24
|
-
# @tc.x_pos.should == @x_pos
|
25
|
-
# end
|
26
|
-
#
|
27
|
-
# it "should know its y position" do
|
28
|
-
# @tc.y_pos.should == @y_pos
|
29
|
-
# end
|
30
|
-
# end
|
31
|
-
#
|
32
|
-
# describe "updates" do
|
33
|
-
# before :each do
|
34
|
-
# @x_pos2 = 0.7
|
35
|
-
# @y_pos2 = 0.4
|
36
|
-
# @x_speed = 0.1
|
37
|
-
# @y_speed = 0.1
|
38
|
-
# @motion_accel = 0.1
|
39
|
-
#
|
40
|
-
# @tc.update( @x_pos2, @y_pos2, @x_speed, @y_speed, @motion_accel )
|
41
|
-
# end
|
42
|
-
#
|
43
|
-
# it "should know it's new x position" do
|
44
|
-
# @tc.x_pos.should == @x_pos2
|
45
|
-
# end
|
46
|
-
#
|
47
|
-
# it "should know it's new y position" do
|
48
|
-
# @tc.y_pos.should == @y_pos2
|
49
|
-
# end
|
50
|
-
#
|
51
|
-
# it "should know it's x speed" do
|
52
|
-
# @tc.x_speed.should == @x_speed
|
53
|
-
# end
|
54
|
-
#
|
55
|
-
# it "should know it's y speed" do
|
56
|
-
# @tc.y_speed.should == @y_speed
|
57
|
-
# end
|
58
|
-
#
|
59
|
-
# it "should know it's motion acceleration" do
|
60
|
-
# @tc.motion_accel.should == @motion_accel
|
61
|
-
# end
|
62
|
-
#
|
63
|
-
# it "should know the path it's traveled" do
|
64
|
-
# first = @tc.path.first
|
65
|
-
# second = @tc.path.last
|
66
|
-
#
|
67
|
-
# first.x_pos.should == 0.8
|
68
|
-
# first.y_pos.should == 0.3
|
69
|
-
#
|
70
|
-
# second.x_pos.should == 0.7
|
71
|
-
# second.y_pos.should == 0.4
|
72
|
-
# end
|
73
|
-
# end
|
74
|
-
# end
|