artoo-joystick 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +9 -0
- data/Gemfile.lock +15 -5
- data/artoo-joystick.gemspec +1 -1
- data/examples/xbox_360_controller.rb +5 -2
- data/lib/artoo-joystick/version.rb +1 -1
- data/lib/artoo/adaptors/joystick.rb +1 -8
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 286793d7267dda24af042bd17b55ff0aeb5ca777
|
4
|
+
data.tar.gz: da69d24c572e50ebd37a0e39a33eff29428861e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d302f72134b42cc08cbb3f3adff65a93a5f3a1662124a37116503e631a834d8b1aacaf283af64ad7049c6b6275f2d17f078420519510a5fb62d1dda8e3973634
|
7
|
+
data.tar.gz: 6fecde154a335843c8e3dacfb29027f8b57c6e61e9daa24459f95d8b7780c874654ee44bb4b0f4d2e32d661fb7ea0e738c258ab2e1ecd584b0b7a85a986582cd
|
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
artoo-joystick (0.
|
5
|
-
artoo (>= 1.
|
4
|
+
artoo-joystick (0.3.0)
|
5
|
+
artoo (>= 1.4.0)
|
6
6
|
hybridgroup-ruby-sdl-ffi
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
artoo (1.
|
11
|
+
artoo (1.4.1)
|
12
12
|
celluloid (~> 0.15.0)
|
13
13
|
celluloid-io (~> 0.15.0)
|
14
14
|
multi_json (~> 1.6)
|
@@ -16,16 +16,18 @@ GEM
|
|
16
16
|
rake
|
17
17
|
reel (~> 0.4.0)
|
18
18
|
thor (~> 0.18.1)
|
19
|
-
celluloid (0.15.
|
19
|
+
celluloid (0.15.2)
|
20
20
|
timers (~> 1.1.0)
|
21
21
|
celluloid-io (0.15.0)
|
22
22
|
celluloid (>= 0.15.0)
|
23
23
|
nio4r (>= 0.5.0)
|
24
24
|
coderay (1.0.9)
|
25
25
|
ffi (1.9.0)
|
26
|
+
ffi (1.9.0-java)
|
26
27
|
http (0.5.0)
|
27
28
|
http_parser.rb
|
28
29
|
http_parser.rb (0.6.0.beta.2)
|
30
|
+
http_parser.rb (0.6.0.beta.2-java)
|
29
31
|
hybridgroup-ruby-sdl-ffi (0.4.1)
|
30
32
|
nice-ffi (>= 0.2)
|
31
33
|
metaclass (0.0.1)
|
@@ -34,14 +36,20 @@ GEM
|
|
34
36
|
minitest-happy (1.0.0)
|
35
37
|
mocha (0.14.0)
|
36
38
|
metaclass (~> 0.0.1)
|
37
|
-
multi_json (1.8.
|
39
|
+
multi_json (1.8.2)
|
38
40
|
nice-ffi (0.4)
|
39
41
|
ffi (>= 0.5.0)
|
40
42
|
nio4r (0.5.0)
|
43
|
+
nio4r (0.5.0-java)
|
41
44
|
pry (0.9.12.2)
|
42
45
|
coderay (~> 1.0.5)
|
43
46
|
method_source (~> 0.8)
|
44
47
|
slop (~> 3.4)
|
48
|
+
pry (0.9.12.2-java)
|
49
|
+
coderay (~> 1.0.5)
|
50
|
+
method_source (~> 0.8)
|
51
|
+
slop (~> 3.4)
|
52
|
+
spoon (~> 0.0)
|
45
53
|
rake (10.1.0)
|
46
54
|
reel (0.4.0)
|
47
55
|
celluloid (>= 0.15.1)
|
@@ -50,6 +58,8 @@ GEM
|
|
50
58
|
http_parser.rb (>= 0.6.0.beta.2)
|
51
59
|
websocket_parser (>= 0.1.4)
|
52
60
|
slop (3.4.6)
|
61
|
+
spoon (0.0.4)
|
62
|
+
ffi
|
53
63
|
thor (0.18.1)
|
54
64
|
timers (1.1.0)
|
55
65
|
websocket_parser (0.1.4)
|
data/artoo-joystick.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
21
|
s.require_paths = ["lib"]
|
22
22
|
|
23
|
-
s.add_runtime_dependency 'artoo', '>= 1.
|
23
|
+
s.add_runtime_dependency 'artoo', '>= 1.4.0'
|
24
24
|
s.add_runtime_dependency 'hybridgroup-ruby-sdl-ffi'
|
25
25
|
s.add_development_dependency 'minitest', '>= 5.0'
|
26
26
|
s.add_development_dependency 'minitest-happy'
|
@@ -4,8 +4,11 @@ connection :joystick, :adaptor => :joystick
|
|
4
4
|
device :controller, :driver => :xbox360, :connection => :joystick, :interval => 0.1
|
5
5
|
|
6
6
|
work do
|
7
|
-
on controller, :
|
8
|
-
puts "joystick
|
7
|
+
on controller, :joystick_0 => proc { |*value|
|
8
|
+
puts "joystick 0 - x:#{value[1][:x]} y:#{value[1][:y]}"
|
9
|
+
}
|
10
|
+
on controller, :joystick_1 => proc { |*value|
|
11
|
+
puts "joystick 1 - x:#{value[1][:x]} y:#{value[1][:y]}"
|
9
12
|
}
|
10
13
|
on controller, :button_a => proc { |*value|
|
11
14
|
puts "ayyyy!"
|
@@ -5,15 +5,8 @@ module Artoo
|
|
5
5
|
# Connect to a joystick device
|
6
6
|
# @see device documentation for more information
|
7
7
|
class Joystick < Adaptor
|
8
|
-
finalizer :finalize
|
9
8
|
attr_reader :joystick
|
10
9
|
|
11
|
-
# Closes connection with device if connected
|
12
|
-
# @return [Boolean]
|
13
|
-
def finalize
|
14
|
-
disconnect if connected?
|
15
|
-
end
|
16
|
-
|
17
10
|
# Creates a connection with device
|
18
11
|
# @return [Boolean]
|
19
12
|
def connect
|
@@ -22,7 +15,7 @@ module Artoo
|
|
22
15
|
::SDL.Init( ::SDL::INIT_JOYSTICK )
|
23
16
|
|
24
17
|
raise "No SDL joystick available" if num_joysticks == 0
|
25
|
-
|
18
|
+
|
26
19
|
@joystick = ::SDL.JoystickOpen(0) # TODO: allow user to choose which joystick
|
27
20
|
|
28
21
|
super
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artoo-joystick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ron Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: artoo
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.4.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: hybridgroup-ruby-sdl-ffi
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,6 +87,7 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- .travis.yml
|
90
91
|
- Gemfile
|
91
92
|
- Gemfile.lock
|
92
93
|
- LICENSE
|