1. Download the rubygame gem from the rubygame official site. The gem is currently version 2.3.0.
2. Install any necessary libraries. The README from the rubygame site states that you are required to have:
1. ruby >= 1.8
2. SDL >= 1.2.7
3. rake >= 0.7.0 (for build/install system)
and that you should, but don't have to have:
1. SDL_gfx >= 2.0.10
2. SDL_image >= 1.2.3
3. SDL_mixer >= 1.2.7
4. SDL_ttf >= 2.0.6
I found that I had to have the last 4 SDL libraries to install the rubygame gem.
So, in case you don't already have ruby, rake and gems, the following ruby rails website lists the required commands to install ruby, rake and gems. Note, it will also install rails support, which is a good thing.
To get the required SDL libraries for rubygame, I installed the following packages via apt-get
E.g. sudo apt-get install libsdl-ruby1.8
Once that was complete, I installed the gem. To install the gem, you must be in a terminal at the directory in which the gem is located. You cannot be in another directory, if you are, it won't find the gem.
To install the gem, I did the following:
1. I placed the .gem file I downloaded on my Desktop.
2. I did the following in the terminal to take me to my gem: cd ~/Desktop
3. I did the following in the terminal to install the gem: gem install gem_file.gem
If you did not receive a gem "install failed" message, you are ready to use rubygame. If you did, read the error message, I found that the error message named the libraries I was missing. An example of an error I received was, "could not find file SDL_IMAGE.h". This error meant that I was missing the libsdl-image1.2-dev package.
The following is an example ruby program you can use to test your rubygame install. Note this is the entire file contents. If your ruby install worked, the app will run, opening a window titled "Hello World".
screen = Rubygame::Screen.set_mode [320,240]
screen.title = 'Hello World'
queue = Rubygame::EventQueue.new
game_over = false
until game_over do
queue.each do |event|
puts "Hello World. Updating"
game_over = true
# END FILE