Ruby/SDL is a ruby extension library for SDL. This library enables you to draw images, handle inputs, and play audio files.
Clone or download
ohai Merge pull request #6 from yhara/markdown-readme
Change README to markdown
Latest commit 946fdef Jan 5, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc-en Update the docs of SDL::WM.set_caption Jan 1, 2016
doc Update the docs of SDL::WM.set_caption Jan 1, 2016
lib Set version to 2.2.0 Aug 6, 2014
sample Use Hinting in font.rb (ttf sample) Jun 7, 2014
sge add glossary files of SGE library Jul 30, 2012
utils Chagne option name from --use-imported-sge to --use-bundled-sge Dec 3, 2013
win32 prepare for 2.1.0 Mar 17, 2009
LICENSE �饤���󥹥ե�������ɲ� Oct 21, 2005
MANIFEST update MANIFEST, add opengl sample Sep 19, 2009
NEWS.en Set version to 2.2.0 Aug 6, 2014
NEWS.ja Set version to 2.2.0 Aug 6, 2014
README.ja Set version to 2.2.0 Aug 6, 2014 Update (use more ``) Dec 31, 2015
SDL_kanji.c SDL_kanji�Υե�������ɲ� Jun 28, 2004
SDL_kanji.h SDL_kanji�Υե�������ɲ� Jun 28, 2004
depend Modify build scripts Oct 31, 2013
doc.txt Initial revision Dec 19, 2000
extconf.rb Chagne option name from --use-imported-sge to --use-bundled-sge Dec 3, 2013 Update packaging script Nov 2, 2013
rubysdl.gemspec Set version to 2.2.0 Aug 6, 2014
rubysdl.h Fix a compilation problem on FreeBSD. Oct 31, 2013
rubysdl_cdrom.c Remove rb_secure Nov 2, 2013
rubysdl_event.c Add constants about SDL::Event.app_state. Feb 11, 2014
rubysdl_event_key.c Remove rb_secure Nov 2, 2013
rubysdl_image.c Remove rb_secure Nov 2, 2013
rubysdl_joystick.c Remove rb_secure Nov 2, 2013
rubysdl_kanji.c Remove rb_secure Nov 2, 2013
rubysdl_main.c Remove rb_secure Nov 2, 2013
rubysdl_mixer.c replace destroyed_ to destroyed? Jun 7, 2014
rubysdl_mouse.c Remove rb_secure Nov 2, 2013
rubysdl_opengl.c define more SDL_GLattr constants. Jun 3, 2014
rubysdl_pixel.c fix compile error and warning Apr 21, 2008
rubysdl_rwops.c Use RB_GC_GUARD in suspicious places. Nov 2, 2013
rubysdl_sdlskk.c Remove rb_secure Nov 2, 2013
rubysdl_sge_video.c Remove rb_secure Nov 2, 2013
rubysdl_smpeg.c Remove rb_secure Nov 2, 2013
rubysdl_time.c Remove rb_thread_blocking_region when SDL_Delay is called. Nov 2, 2013
rubysdl_ttf.c Add SDL::TTF#hinting and SDL::TTF#hinting= Jun 7, 2014
rubysdl_video.c Remove rb_secure Nov 2, 2013
rubysdl_wm.c Remove rb_secure Nov 2, 2013

What's Ruby/SDL

Ruby/SDL is the ruby extension library to use SDL. SDL(Simple DirectMedia Layer) is a cross-platform multimedia library
designed to provide fast access to the graphics framebuffer and audio
devices. See if you want to know SDL in detail.


This library supports Linux, Win32, MacOS X.

This library perhaps works on FreeBSD and other standard Unix-like systems.

Library Needed

Ruby/SDL needs Ruby and SDL and optionally uses SDL_image, SDL_mixer, SDL_ttf, SGE, OpenGL and SMPEG.




Some packages are available: Debian's .deb, FreeBSD's ports, or Windows' zipfile.

RubyGems are also available. You can install Ruby/SDL:

gem install rubysdl

You can install from source code as follows:

  1. install Ruby : See Ruby's document and install.

  2. install SDL : Extract SDL's source and run ./configure. And run make, make install.

  3. install SGE : Run make and make install.

  4. install SDL_mixer, SDL_ttf, SDL_image, SMPEG and SDLSKK : See documents of these libraries and install them .

  5. install this extension library,Ruby/SDL : Run ruby extconf.rb, make and make install.

  6. (Mac OS X user only) install rsdl : Run gem install rsdl. rsdl is a wrapper of the Ruby interpreter. This wrapper prepares Cocoa framework before running the interpreter.

Use SGE without installing the library

You can use SGE without intalling:

gem install rubysdl -- --enable-bundled-sge


ruby extconf.rb --enable-bundled-sge

However, please do not use this option if you have other way. Please install SGE separately if possible.


Write require 'sdl' in your Ruby script. If your system is OS X, you must use rsdl command as an interpreter instead of ruby command.

See following documents and samples if you want to know the detail.

  • sample/*.rb : Ruby/SDL samples. In some scripts, you have to prepare data such as sample.wav and sample.mpg.
  • rubysdl_ref.en.html : The reference manual
  • rubysdl_ref.en.rd : RD style reference manual(the contents is same as rubysdl_ref.en.html)
  • documents of SDL : This is in SDL archive. Please read this when you want to know what does't describe these documents.


You can use OpenGL with this library.

  1. Setup OpenGL and SDL.
  2. Install ruby-opengl (
  3. Run ruby extconf.rb, make, and make install
  4. Write require 'sdl'; require 'opengl' in your script.

We use OpenGL through ruby-opengl. Please see SDL's document, OpenGL document and sample/testgl.rb .


This library is distributed under GNU LGPL version 2.1 or later, which can be found in the file LICENSE. But samples, the Ruby scripts sample/*.rb, are not under LGPL, and you can use their files freely.


Thanks to ...

  • Tamura : some patches and advertising
  • Akinori MUSHA : Porting on FreeBSD
  • Danny van Bruggen : some ideas are from his library "RUDL"
  • akira yamada : patch of SDL::TTF, making packages of Vine and Debian.
  • Wayne Conrad : some patches
  • Christian Neukirchen, Kent Dahl : send a patch
  • Keffin Barnaby : some patches
  • Rorien Dunn, Dennis Ranke, Keita Urashima : bug reports and useful information
  • Yusuke TABATA : introduce me into SDL world
  • SDLdoc Japanese translation project : base of Ruby/SDL's reference manual
  • Hara Yutaka: Sample TrueTypeFont, MacOS X support
  • Members of #sdl-fan-jp @ FriendChat: bug reports and advices
  • Cyross Makoto: Windows support
  • Dwayne C. Litzenberger: Some patches


Some functions, especially SDL::MPEG methods and pallete handling methods, are not tested.


  • Ippei Obayashi: main developer
  • Cyross Makoto: Windows suppport
  • yhara: MacOS X support

Please send comments and bug reports to the author. Author's mail address: