# Ruby-sdl problem

**URL:** <https://www.ruby-forum.com/t/ruby-sdl-problem/186192>\
**Category:** Ruby\
**Created:** [April 1, 2010, 11:01pm UTC](https://www.ruby-forum.com/t/ruby-sdl-problem/186192 "2010-04-01T23:01:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jvalencia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/958977/32.png) [@jvalencia](https://www.ruby-forum.com/u/jvalencia)\
**Post date:** [April 1, 2010, 11:01pm UTC](https://www.ruby-forum.com/t/ruby-sdl-problem/186192/1 "2010-04-01T23:01:38Z")

</div>

Hi, I’ve been reading this introduction to rubysdl

([O'Reilly Media - Technology and Business Training](http://www.oreillynet.com/pub/a/ruby/2007/12/04/creating-games-in-ruby.html))

and wanted to try it.

My problem is the following:

irb(main):001:0\> require “rubygems”  
=\> true  
irb(main):002:0\> require “sdl”  
=\> true  
irb(main):004:0\> SDL::init(SDL::INIT\_VIDEO)  
=\> nil  
irb(main):005:0\> screen = SDL::Screen.open(640,480,24,SDL::SWSURFACE)  
=\> #SDL::Screen:0x7fba2ba87798  
irb(main):006:0\> image = SDL::Surface.load(“humans.png”)  
NoMethodError: private method `load’ called for SDL::Surface:Class  
from (irb):5

How do I load an image?

Documentation extract:

SDL::Surface.load(filename)

```
Load image into an surface and returns surface object. If image

```

format supports transparent color, colorkey is set into new surfafe.

```
Supoorted formats are BMP, PNM (PPM/PGM/PBM), XPM, XCF, PCX, GIF,

```

JPEG, TIFF, TGA, PNG and LBM.

```
Raises SDL::Error on failure

You need SDL_image to use this method.

```

* * *

gem list --local rubysdl

\*\*\* LOCAL GEMS \*\*\*

rubysdl (2.1.1)

---

<div class="post-metadata">

**Author:** ![jvalencia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/958977/32.png) [@jvalencia](https://www.ruby-forum.com/u/jvalencia)\
**Post date:** [April 2, 2010, 12:28pm UTC](https://www.ruby-forum.com/t/ruby-sdl-problem/186192/2 "2010-04-02T12:28:56Z")

</div>

> irb(main):002:0\> require “sdl”
> 
> ```
> Raises SDL::Error on failure
> 
> ```
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

Hi,  
would suggest looking at  
[http://www.kmc.gr.jp/~ohai/rubysdl.en.html](http://www.kmc.gr.jp/~ohai/rubysdl.en.html)  
which seems to be official web of the library, maintained by it’s  
developer(s).

I looked quickly into the documentation and haven’t found method  
Surface.load - which, of course, probably means I haven’t searched good  
enough.

When I had to solve problems with some “SDL for Ruby” library, it was  
often caused by problems with compilation - e.g. I didn’t have SDL\_image  
library installed on my system or the make script wasn’t able to find it  
when compiling the Ruby port. Have you checked this?  
(E.g. RUDL and Rubygame can be compiled with minimum of SDL libraries -  
but don’t offer some classes and/or methods then…)

Jakub

P.S.: I myself don’t like Ruby/SDL very much and use Rubygame or even  
ancient unmaintained RUDL instead, but you probably know why you want to  
use the SDL port you have chosen…
