rcade_controls 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ea22fbc1a831f7053b99b202b219c5abe5bd2250
4
+ data.tar.gz: 578566025aa0fc4cd9d3d333d2e8cc1e87d33436
5
+ SHA512:
6
+ metadata.gz: c11d7e226c7a7cf40eec759f8e5a1645d89b58b8407359119e409d2e6f0a7671139f083123efc7287d15e80a8571f20226a29c4b24bd5f36f922ddc3787a2b5b
7
+ data.tar.gz: e8b4dd5a89e9567a5c5d91d65d9606e482ebd7eda91d8a0aa7bcba7877ff69101867bef56ed19b35b0a41223c57a9704de20e10f997710cd308e16e40ae0a4e3
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0-p0
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Andrew Havens
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ This library maps the [standard arcade controller keys](http://www.ultimarc.com/ipac2.html) to Ruby constants that can be used when checking which button was pressed. This library assumes you're creating a Gosu game. Please submit a pull request if you would like to support other game libraries.
2
+
3
+ ## Installation
4
+
5
+ Add this line to your game's Gemfile:
6
+
7
+ gem 'rcade_controls'
8
+
9
+ And then execute:
10
+
11
+ $ bundle
12
+
13
+ Or install it yourself as:
14
+
15
+ $ gem install rcade_controls
16
+
17
+ ## Usage
18
+
19
+ In your game, you can check if the key pressed matches the button that you expect:
20
+
21
+ ```ruby
22
+ class Game < Gosu::Window
23
+ def button_down(button)
24
+ case button
25
+ when Coin1, Coin2
26
+ insert_coin
27
+ when P1Start
28
+ start_game
29
+ when P1Up, P1Down, P1Left, P1Right
30
+ move_player_one(button)
31
+ when P1Button1
32
+ attack!
33
+ when Escape
34
+ close
35
+ end
36
+ end
37
+ end
38
+ ```
39
+
40
+ For a full list of the supported buttons, refer to the [source code](https://github.com/ruby-rcade/rcade_controls/blob/master/lib/rcade_controls.rb).
41
+
42
+ ## Contributing
43
+
44
+ 1. Fork it
45
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
46
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
47
+ 4. Push to the branch (`git push origin my-new-feature`)
48
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,53 @@
1
+ require 'gosu'
2
+
3
+ module RcadeControls
4
+
5
+ Escape = Gosu::KbEscape
6
+
7
+ Coin1 = Gosu::Kb5
8
+ Coin2 = Gosu::Kb6
9
+ Coin3 = Gosu::Kb7
10
+ Coin4 = Gosu::Kb8
11
+
12
+ P1Start = Gosu::Kb1
13
+ P2Start = Gosu::Kb2
14
+ P3Start = Gosu::Kb3
15
+ P4Start = Gosu::Kb4
16
+
17
+ P1Up = Gosu::KbUp
18
+ P1Down = Gosu::KbDown
19
+ P1Left = Gosu::KbLeft
20
+ P1Right = Gosu::KbRight
21
+ P1ButtonA = Gosu::KbP
22
+ P1ButtonB = Gosu::KbReturn
23
+ P1Button1 = Gosu::KbLeftControl
24
+ P1Button2 = Gosu::KbLeftAlt
25
+ P1Button3 = Gosu::KbSpace
26
+ P1Button4 = Gosu::KbLeftShift
27
+ P1Button5 = Gosu::KbZ
28
+ P1Button6 = Gosu::KbX
29
+ P1Button7 = Gosu::KbC
30
+ P1Button8 = Gosu::KbV
31
+ P1Button9 = Gosu::KbB
32
+ P1Button10 = Gosu::KbN
33
+
34
+ P2Up = Gosu::KbR
35
+ P2Down = Gosu::KbF
36
+ P2Left = Gosu::KbD
37
+ P2Right = Gosu::KbG
38
+ P2ButtonA = Gosu::KbTab
39
+ P2ButtonB = Gosu::KbEscape
40
+ P2Button1 = Gosu::KbA
41
+ P2Button2 = Gosu::KbS
42
+ P2Button3 = Gosu::KbQ
43
+ P2Button4 = Gosu::KbW
44
+ P2Button5 = Gosu::KbI
45
+ P2Button6 = Gosu::KbK
46
+ P2Button7 = Gosu::KbJ
47
+ P2Button8 = Gosu::KbL
48
+
49
+ end
50
+
51
+ class Gosu::Window
52
+ include RcadeControls
53
+ end
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "rcade_controls"
5
+ spec.version = "0.0.3"
6
+ spec.authors = ["Andrew Havens"]
7
+ spec.email = ["email@andrewhavens.com"]
8
+ spec.description = %q{A Ruby library of standard arcade controller mappings.}
9
+ spec.summary = %q{A Ruby library of standard arcade controller mappings.}
10
+ spec.homepage = "https://github.com/ruby-rcade/rcade_controls"
11
+ spec.license = "MIT"
12
+
13
+ spec.files = `git ls-files`.split($/)
14
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.require_paths = ["lib"]
17
+
18
+ spec.add_dependency "gosu"
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "rake"
22
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rcade_controls
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Havens
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gosu
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A Ruby library of standard arcade controller mappings.
56
+ email:
57
+ - email@andrewhavens.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - .ruby-version
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - lib/rcade_controls.rb
69
+ - rcade_controls.gemspec
70
+ homepage: https://github.com/ruby-rcade/rcade_controls
71
+ licenses:
72
+ - MIT
73
+ metadata: {}
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 2.0.2
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: A Ruby library of standard arcade controller mappings.
94
+ test_files: []