1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
Ruby/SDL 0.7
Ohbayashi Ippei
1
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
device. See http://www.libsdl.org/ if you want to know SDL in detail.
This is still under development.
2 Platform
This library supports
Linux on X,Win32,FreeBSD and BeOS.
3 Library Needed
Ruby/SDL needs Ruby and SDL and optionally uses SDL_image,SDL_mixer,
SDL_ttf, SGE and SMPEG.
Indispensable
Ruby http://www.ruby-lang.org/
SDL http://www.libsdl.org/
forwardable ftp://ftp.netlab.co.jp/pub/lang/ruby/contrib/forwardable-1.1.tgz
( you can use forwardable without install in Ruby 1.6.4 or later )
Optional
SDL_mixer http://www.libsdl.org/projects/SDL_mixer/index.html
SDL_ttf http://www.libsdl.org/projects/SDL_ttf/index.html
SDL_image http://www.libsdl.org/projects/SDL_image/index.html
SGE http://www.etek.chalmers.se/~e8cal1/sge/
SMPEG http://www.lokigames.com/development/smpeg.php3
4 INSTALL
install on FreeBSD
Use Port.
install on Linux
(1)install Ruby
See Ruby's document and install.
(2)install SDL
Extract SDL's source and run './configure' with '--disable-pthreads'
option.
On Linux using pthread with Ruby/SDL makes problem.
And run 'make','make install'.
(3)install SGE
Edit Makefile.conf to make valid 'C_ONLY=y'.
And run 'make' and copy libSGE.a to /usr/local/lib and
copy *.h to /usr/local/lib/SDL .
On newer version ( after 010224 ) you can use 'make install',so use
this.
(4)install SDL_mixer,SDL_ttf,SDL_image
See documents of these libraries and install them .
(5)install this extension library,Ruby/SDL
Run 'ruby extconf.rb','make' and 'make install'.
5 USE Ruby/SDL
Write "require 'sdl'" in your Ruby script.
See following documents and samples if you want to know the detail.
sample/*.rb
Ruby/SDL samples.In some script, you have to prepare data such as
"sample.wav" and "sample.mpg".
rubysdl_const_list.txt
List of constants
rubysdl_doc.en.rd
Simple reference manual
document of SDL
This is in SDL archive.
Please read this when you want to know what does't describe
these documents.
6 OpenGL
You can use OpenGL with this library.
(1) Setup OpenGL and SDL.
(2) Get OpenGL Interface from http://www.ruby-lang.org/en/raa.html
(3) Extract source of OpenGL Interface and copy rbogl.h ,rbogl.c ogl.c
glu.c to the directory of this library.
(5) Run "ruby extconf.rb" with "--enable-opengl", "--linkoglmodule"
and "--with-x11-dir=/usr/X11R6"( only Unix like OS )
options.
(6) Run "make" and "make install"
You can also use OpenGL in following way.
(1) Setup OpenGL and SDL.
(2) Get OpenGL Interface from http://www.ruby-lang.org/en/raa.html
(3) Install OpenGL Interface
(4) Run "ruby extconf.rb" with "--enable-opengl".
(5) Run "make" and "make install"
(6) Write "require 'sdl'; require 'opengl'" in your script.
The interface of OpenGL is same as "OpenGL Interface".
Please see SDL's document,OpenGL document and sample/testgl.rb .
Each OpenGL implementation are a little different in API, so
you may fail to compile Ruby's OpenGL Interface. If you can't
compile, but if you want to complile it, you should modify
sources.
7 LICENSE
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.
8 Thanks
Tamura : some patches and advertising
Akinori MUSHA : Porting on FreeBSD
Danny van Bruggen : some ideas are from his library "RUDL"
9 OTHER
Many functions are not tested.
Please send comments and bug reports to the author.
Author's mail address: ohai@kmc.kyoto-u.ac.jp
|