Ruby-SDL-FFI 0.3 released

Ruby-SDL-FFI 0.3 is now available. The biggest change is that Ruby-SDL-FFI apps (and Rubygame apps) can now run on Mac OS X with no special interpreter. In the past, Mac users had to run apps a special Ruby interpreter called RSDL. Now, this is no longer necessary — Mac users can now use the standard Ruby interpreter, even JRuby. (Eternal thanks to erisdiscord and jlnr for their advice and tips!)

This solution has only been tested on Mac OS X 10.5 (Leopard) on an Intel Mac. If you try it on a different setup, please leave a comment to let me know whether it works or not.

Release notes:

  • Ruby-SDL-FFI can now work on Mac OS X without the need for a special interpreter (i.e. rsdl). If this causes issues for you, you can disable it by setting the RUBYSDLFFI_NOCOCOA environment variable to "true".
  • Added the SDL::set_app_name() method. This sets the application name in a platform-appropriate way, or does nothing if the platform is not supported. On Mac OS X, it changes the text in the menu bar. Support for other platforms may be added in the future.
  • Ruby-SDL-FFI now reads the RUBYSDLFFI_PATH environment variable for additional library load paths. It should be a colon-separated (Linux/Mac) or semicolon-separated (Windows) list of directories to search for libraries
  • The SDL::Palette class is now Enumerable. You can iterate over it with #each, #collect, etc. You can also read a specific index using #at (but not #[], which is reserved for struct access)
  • SDL.GL_GetAttribute() now returns an integer, like it should. Before, it would return an FFI::Buffer.
  • SDL.GetKeyRepeat() is now easier to use. It returns an Array of two integers: [delay, interval]. Before, you had to pass two output buffers, then extract the integers afterwards.
  • Fixed a NoMethodError in SDL.WaitEvent().
  • Ruby-SDL-FFI now uses FFI::Buffer instead of FFI::MemoryPointer in many places. This should give a slight performance boost on JRuby, and potentially other platforms.

The easiest way to install Ruby-SDL-FFI is with gem install ruby-sdl-ffi. (If you want to use Ruby-SDL-FFI or Rubygame on JRuby, you should install the ffi stub gem first.) Gem and source tarballs are also available, and you can get the source from Github too:



Tyler submitted a comment on #

I’ve got Mac OS X 10.6.4, and ruby-sdl-ffi almost works, the game window opens, I the graphics are drawn, the audio plays, but clicking on the game window never makes it active (if that’s the correct term, I mean I can see the window, but the title bar is grayed out, clicking on the window brings it to the top, but not into focus. Any keyboard input is sent to the application you were previously using, such as Finder or Terminal). Oddly enough the close and minimize window buttons work on the game window.

I wish I could help fix it, but I know next to nothing about Apple/Cocca APIs, sorry. I’m more than willing to try out any changes to ruby-sdl-ffi if you need a tester for 10.6.

Alexey Lavrenuke submitted a comment on #

Hello! This is an offtopic, but it’s an emergency and I don’t know where to post it. Your wiki page was defaced by smb. There is a virus link there. Please, take care about that.

btw, your lib (RubyGame) is very nice. I loved using it, thanks for that!

Have something interesting to add to the discussion? Email your thoughtful comments to