0.0
No commit activity in last 3 years
No release in over 3 years
A library of standard arcade controller keyboard mappings.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0

Runtime

>= 0
 Project Readme

This library maps the standard arcade controller keyboard mapping 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.

Installation

Add this line to your game's Gemfile:

gem 'rcade_controls'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rcade_controls

Usage

In your game, you can check if the key pressed matches the button that you expect:

class Game < Gosu::Window
  def button_down(button)
    case button
    when Coin1, Coin2    then insert_coin
    when P1Start         then start_one_player_game
    when P1Left, P1Right then move_player_one(button)
    when P1Button1       then player_one_attack!
    when Quit            then close
    end
  end
end

For the full list of mappings, refer to the source code.