This project has been deprecated! Check out its successor, Ruby 2D.
R2D is a gem for drawing 2D graphics, animations, playing audio, capturing input, and more. It aims to be a simple and lightweight programmable graphics engine suitable for casual 2D games, visualizations, education, and more.
WARNING: This gem is still in development! This means the API and implementation are very much in flux. Review the latest API documentation and the change log for more info.
View the R2D website for news and updates (this site is also still in development). To share ideas, ask questions, or discuss anything in general, check out the Google group. Tweet me (the author) at @blacktm.
Until a v0.1.0 public release, this gem will only be available locally. To build and install, use:
$ rake build
This Rake task will build and install the gem locally and verbosely.
This gem requires Homebrew on OS X to install SDL2. If you prefer not to install Homebrew and already have SDL2 available on your $PATH
, use the --use-system-libs
option:
$ gem install r2d -- --use-system-libs
This option will search for SDL2 libs using -lSDL2
style arguments. The extconf.rb
will check to make sure libs are available during the gem install
process.
This gem doesn't currently support Windows or Linux, but we're working on it (including the Raspberry Pi).
If you know of a way to conveniently install SDL2 on Windows, let me know!
The examples/
directory contains a variety of R2D sample applications. These examples are being used to test the gem while implementing the API and underlying engine.
Run tests using:
$ rake test
This gem uses minitest
, but we have no tests at the moment. A big challenge in testing a gem for graphics and audio is some tests can't be fully automated, e.g. did that square draw correctly, or did that sound play correctly? For this reason, we're still working on a comprehensive testing strategy.
R2D requires Ruby 2.0 or greater. Native extensions are used in this gem, so a compiler is needed. The intent is for R2D to be a fully cross-platform graphics environment and should run on OS X, Windows, and Linux.
So far, the gem has been tested on:
OS | Ruby | Env | SDL2 |
---|---|---|---|
OS X 10.9 | 2.0.0-p353 | rbenv 0.4.0 | 2.0.1 / Homebrew |
OS X 10.9.1 | 2.1.0 | rbenv 0.4.0 | 2.0.1 / Homebrew |