Have you've ever wanted to make games with ruby? Gosu is a 2D game development library for Ruby and C++. It provides a window and main loop, 2D graphics and text (powered by OpenGL), sound, music, keyboard, mouse, and gamepad input.
I'll be showing how to install Gosu on OSX, but they also offer tutorials on setting gosu up with Windows, Linux, Raspbian.
Gosu depends on the SDL 2 library. So make sure you have Homebrew installed and run
brew install sdl2. When that's done, simply install the Gosu gem with
gem install gosu.
To test whether everything works as expected, you can use this one-liner, which should open a window:
ruby -rgosu -e 'w = Gosu::Window.new(200, 150); w.caption = "It works!"; w.show'
Or you can install and run the gosu-examples gem:
gem install gosu-examples gosu-examples
I recommend you should do the latter.
This tutorial window shows you what Gosu is capable of. Even better, they have a shortcut to the source code for each example! You can view the source code by pressing
E And if you like they have a code-along for the
There's so much you can do with this lightweight gem. Here's a link to the Gosu Showsace where you can download community projects or post your own!