rubygame 2.5.3 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CREDITS +6 -4
- data/NEWS +79 -0
- data/README +55 -72
- data/ROADMAP +20 -13
- data/doc/custom_sdl_load_paths.rdoc +79 -0
- data/doc/getting_started.rdoc +65 -36
- data/doc/keyboard_symbols.rdoc +243 -0
- data/doc/macosx_install.rdoc +49 -35
- data/doc/windows_install.rdoc +36 -108
- data/lib/rubygame.rb +62 -24
- data/lib/rubygame/audio.rb +147 -0
- data/lib/rubygame/clock.rb +164 -1
- data/lib/rubygame/color.rb +40 -7
- data/lib/rubygame/color/models/hsl.rb +1 -1
- data/lib/rubygame/color/models/hsv.rb +1 -1
- data/lib/rubygame/color/models/rgb.rb +1 -1
- data/lib/rubygame/color/palettes/css.rb +1 -3
- data/lib/rubygame/color/palettes/x11.rb +1 -2
- data/lib/rubygame/constants.rb +297 -0
- data/lib/rubygame/deprecated_mixer.rb +555 -0
- data/lib/rubygame/event.rb +122 -6
- data/lib/rubygame/event_handler.rb +3 -1
- data/lib/rubygame/event_hook.rb +6 -2
- data/lib/rubygame/event_triggers.rb +1 -1
- data/lib/rubygame/events.rb +416 -1
- data/lib/rubygame/ftor.rb +1 -7
- data/lib/rubygame/gfx.rb +583 -0
- data/lib/rubygame/gl.rb +107 -0
- data/lib/rubygame/image.rb +140 -0
- data/lib/rubygame/joystick.rb +184 -0
- data/lib/rubygame/main.rb +82 -0
- data/lib/rubygame/mediabag.rb +1 -1
- data/lib/rubygame/mixer.rb +30 -0
- data/lib/rubygame/music.rb +493 -0
- data/lib/rubygame/queue.rb +3 -1
- data/lib/rubygame/rect.rb +9 -9
- data/lib/rubygame/screen.rb +357 -0
- data/lib/rubygame/shared.rb +40 -4
- data/lib/rubygame/sound.rb +428 -0
- data/lib/rubygame/surface.rb +626 -0
- data/lib/rubygame/ttf.rb +311 -0
- data/samples/FreeSans.ttf +0 -0
- data/samples/README +6 -5
- data/samples/demo_draw.rb +1 -1
- data/samples/demo_gl.rb +3 -1
- data/samples/demo_gl_tex.rb +4 -2
- data/samples/demo_rubygame.rb +114 -105
- data/samples/demo_sfont.rb +1 -1
- data/samples/demo_ttf.rb +3 -1
- data/samples/demo_utf8.rb +1 -1
- data/samples/image_viewer.rb +118 -0
- data/samples/load_and_blit.rb +1 -1
- data/samples/rubygame.png +0 -0
- metadata +34 -40
- data/Rakefile +0 -537
- data/doc/extended_readme.rdoc +0 -49
- data/ext/body/rubygame_body.so +0 -0
- data/ext/rubygame/rubygame_clock.c +0 -301
- data/ext/rubygame/rubygame_clock.h +0 -32
- data/ext/rubygame/rubygame_event.c +0 -760
- data/ext/rubygame/rubygame_event.h +0 -48
- data/ext/rubygame/rubygame_event2.c +0 -661
- data/ext/rubygame/rubygame_event2.h +0 -29
- data/ext/rubygame/rubygame_gfx.c +0 -942
- data/ext/rubygame/rubygame_gfx.h +0 -101
- data/ext/rubygame/rubygame_gl.c +0 -154
- data/ext/rubygame/rubygame_gl.h +0 -32
- data/ext/rubygame/rubygame_image.c +0 -252
- data/ext/rubygame/rubygame_image.h +0 -41
- data/ext/rubygame/rubygame_joystick.c +0 -336
- data/ext/rubygame/rubygame_joystick.h +0 -41
- data/ext/rubygame/rubygame_main.c +0 -158
- data/ext/rubygame/rubygame_main.h +0 -36
- data/ext/rubygame/rubygame_mixer.c +0 -1024
- data/ext/rubygame/rubygame_mixer.h +0 -36
- data/ext/rubygame/rubygame_music.c +0 -1017
- data/ext/rubygame/rubygame_music.h +0 -29
- data/ext/rubygame/rubygame_screen.c +0 -572
- data/ext/rubygame/rubygame_screen.h +0 -45
- data/ext/rubygame/rubygame_shared.c +0 -269
- data/ext/rubygame/rubygame_shared.h +0 -69
- data/ext/rubygame/rubygame_sound.c +0 -863
- data/ext/rubygame/rubygame_sound.h +0 -29
- data/ext/rubygame/rubygame_surface.c +0 -1153
- data/ext/rubygame/rubygame_surface.h +0 -62
- data/ext/rubygame/rubygame_ttf.c +0 -599
- data/ext/rubygame/rubygame_ttf.h +0 -69
- data/samples/keys.rb +0 -52
data/CREDITS
CHANGED
@@ -5,25 +5,27 @@
|
|
5
5
|
Role:: Creator; primary developer
|
6
6
|
Date:: 2004 - present
|
7
7
|
|
8
|
+
== Past Developers
|
9
|
+
|
8
10
|
- <b>Ash Wilson</b> / smashwilson
|
9
11
|
Email:: smashwilson at gmail.com
|
10
12
|
Role:: Assistant developer
|
11
|
-
Date:: 2007 -
|
13
|
+
Date:: 2007 - 2008
|
12
14
|
|
13
15
|
- <b>Roger Ostrander</b> / denor
|
14
16
|
Email:: atiaxi at gmail.com
|
15
17
|
Role:: Assistant developer
|
16
|
-
Date:: 2007 -
|
18
|
+
Date:: 2007 - 2008
|
17
19
|
|
18
20
|
- <b>Rusterholz Stefan</b> / apeiros
|
19
21
|
Email:: apeiros at gmx.net
|
20
22
|
Role:: Assistant developer
|
21
|
-
Date:: 2007 -
|
23
|
+
Date:: 2007 - 2008
|
22
24
|
|
23
25
|
- <b>Bjorn De Meyer</b> / beoran
|
24
26
|
Email:: beoran at gmail.com
|
25
27
|
Role:: Assistant developer
|
26
|
-
Date:: Nov 2007 -
|
28
|
+
Date:: Nov 2007 - 2008
|
27
29
|
|
28
30
|
== Other Source Contributors
|
29
31
|
|
data/NEWS
CHANGED
@@ -1,5 +1,84 @@
|
|
1
1
|
= NEWS
|
2
2
|
|
3
|
+
== Rubygame 2.6.0
|
4
|
+
|
5
|
+
Release focus: Ported to FFI.
|
6
|
+
|
7
|
+
=== FFI
|
8
|
+
|
9
|
+
Rubygame is now pure Ruby, with no compiled C code. Instead, it uses
|
10
|
+
Ruby-FFI (or compatible FFI implementations) to directly access SDL
|
11
|
+
and related libraries. That means:
|
12
|
+
|
13
|
+
- It is much easier to install. You can install it directly from
|
14
|
+
RubyGems (`gem install rubygame`) on any operating system, and you
|
15
|
+
don't need a C compiler or SDL headers.
|
16
|
+
|
17
|
+
- It is now possible to use Rubygame on JRuby, and possibly on
|
18
|
+
Rubinius.
|
19
|
+
|
20
|
+
- Rubygame will be slightly slower than before. But, the hard work is
|
21
|
+
still being done by SDL, so the speed decrease is only minor. The
|
22
|
+
increased portability and ease of future development greatly
|
23
|
+
outweighs the small speed loss.
|
24
|
+
|
25
|
+
Despite the major architectural change, Rubygame 2.6 API is meant to
|
26
|
+
be backwards compatible with Rubygame 2.5 and earlier. If you find an
|
27
|
+
API incompatibility, you should report it as a bug.
|
28
|
+
|
29
|
+
However, there are a few minor incompatibilities that are already known,
|
30
|
+
and most likely cannot or will not be fixed:
|
31
|
+
|
32
|
+
- Surface#flip now needs SDL_gfx to run. Before, it needed only plain
|
33
|
+
SDL, but the code for it was too slow when reimplemented in Ruby.
|
34
|
+
|
35
|
+
- Rubygame::VERSIONS[:sdl_gfx] now reports [0,0,0] when SDL_gfx is
|
36
|
+
available, instead of its real version number. SDL_gfx does not
|
37
|
+
currently provide any way to detect its version number at run time.
|
38
|
+
(VERSIONS still reports nil when SDL_gfx is not available, the same
|
39
|
+
as in 2.5 and earlier.)
|
40
|
+
|
41
|
+
=== Fixes
|
42
|
+
|
43
|
+
- Fixed: Surface#set_at() now correctly sets the pixel's opacity for
|
44
|
+
Surfaces with an alpha channel. If no opacity is given for the new
|
45
|
+
color (i.e. only RGB), the pixel will be fully opaque.
|
46
|
+
|
47
|
+
- Note: Due to a long-standing bug, Surface.new cannot create a
|
48
|
+
Surface with an alpha channel. Use Surface#to_display_alpha to
|
49
|
+
create an alpha-channeled copy of the Surface, or load an image
|
50
|
+
file that has an alpha channel already.
|
51
|
+
|
52
|
+
- Fixed: Music.load now automatically opens audio if needed. MP3s (and
|
53
|
+
perhaps other file types) would fail to load in some circumstances
|
54
|
+
if audio was not open.
|
55
|
+
|
56
|
+
=== Other Changes
|
57
|
+
|
58
|
+
- Rubygame now automatically initializes itself when loaded and cleans
|
59
|
+
itself up at exit. So, you no longer need to call Rubygame.init or
|
60
|
+
Rubygame.quit in your code (but it won't hurt if you do).
|
61
|
+
|
62
|
+
- Added: New sample application, a basic image viewer.
|
63
|
+
See samples/image_viewer.rb.
|
64
|
+
|
65
|
+
- Added: Documentation listing every keyboard symbol used by Rubygame.
|
66
|
+
See doc/keyboard_symbols.rdoc.
|
67
|
+
|
68
|
+
- Added: Guide to setting custom load parts for SDL libraries.
|
69
|
+
See doc/custom_sdl_load_paths.rdoc.
|
70
|
+
|
71
|
+
- Surface#alpha= is now a true alias for Surface#set_alpha. It was a
|
72
|
+
separate method before. It can still be used in the same way as
|
73
|
+
before.
|
74
|
+
|
75
|
+
- Surface#colorkey= is now a true alias for Surface#set_colorkey. It
|
76
|
+
was a separate method before. It can still be used in the same way
|
77
|
+
as before.
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
3
82
|
== Rubygame 2.5.3
|
4
83
|
|
5
84
|
Release focus: Bug fixes.
|
data/README
CHANGED
@@ -2,126 +2,109 @@
|
|
2
2
|
|
3
3
|
== What is Rubygame?
|
4
4
|
|
5
|
-
Rubygame is a cross-platform game-development
|
6
|
-
inspired by Pygame.
|
7
|
-
providing them with powerful and flexible high
|
8
|
-
worrying about low-level technical details, you can focus
|
9
|
-
more interesting things (like making a fun game).
|
10
|
-
|
11
|
-
Rubygame's core is written in C to bind low-level SDL functions into Ruby.
|
12
|
-
On top of that is a pure Ruby library for higher-level behavior like
|
13
|
-
event and game object management.
|
5
|
+
Rubygame is a cross-platform game-development library for Ruby,
|
6
|
+
inspired by Pygame. Rubygame strives to empower game developers by
|
7
|
+
providing them with powerful and flexible mid-to-high level tools.
|
8
|
+
Instead of worrying about low-level technical details, you can focus
|
9
|
+
your energy on more interesting things (like making a fun game).
|
14
10
|
|
15
11
|
=== Relevant Links
|
16
12
|
1. Rubygame: http://rubygame.org
|
17
13
|
2. Ruby: http://www.ruby-lang.org
|
18
14
|
3. Pygame: http://www.pygame.org
|
19
|
-
|
15
|
+
|
20
16
|
|
21
17
|
== Requirements
|
22
18
|
|
23
|
-
You will definitely need these software packages to
|
19
|
+
You will definitely need these software packages to use Rubygame:
|
24
20
|
|
25
|
-
*
|
26
|
-
* SDL
|
27
|
-
*
|
21
|
+
* Ruby >= 1.8
|
22
|
+
* Ruby-SDL-FFI >= 0.1
|
23
|
+
* SDL >= 1.2.7 (1.2.14 on MacOS X 10.6)
|
24
|
+
* (MacOS X only): RSDL ( http://github.com/knu/rsdl )
|
28
25
|
|
29
26
|
It's highly recommended that you have these packages as well, or some
|
30
27
|
cool features won't be available!
|
31
28
|
|
32
|
-
* SDL_gfx >= 2.0.
|
29
|
+
* SDL_gfx >= 2.0.13
|
33
30
|
* SDL_image >= 1.2.3
|
34
31
|
* SDL_mixer >= 1.2.7
|
35
32
|
* SDL_ttf >= 2.0.6
|
36
33
|
|
37
|
-
(If you don't have some of those, you have to disable those features
|
38
|
-
by passing some flags to the build process. See "Advanced Install", below.)
|
39
|
-
|
40
|
-
If you are compiling source on a binary-based Linux ditribution,
|
41
|
-
you will also need the "dev" packages of ruby, SDL, SDL_gfx, SDL_image,
|
42
|
-
SDL_mixer, and SDL_ttf. (Really, you just need the header files.)
|
43
|
-
|
44
|
-
And of course, if you are compiling the source, you will need a C compiler!
|
45
|
-
These versions of gcc worked fine when I tried them; other compilers might
|
46
|
-
work too:
|
47
|
-
|
48
|
-
* gcc 3.3, 3.4, 4.0, 4.1
|
49
|
-
|
50
34
|
|
51
35
|
== Install
|
52
36
|
|
53
37
|
=== Basic Install
|
54
38
|
|
55
|
-
|
56
|
-
Then run ($ indicates as user, # as root):
|
57
|
-
|
58
|
-
$ rake build
|
59
|
-
# rake install
|
60
|
-
|
61
|
-
=== Advanced Install
|
62
|
-
|
63
|
-
The build and install tasks can be configured by providing certain commands
|
64
|
-
to rake:
|
65
|
-
|
66
|
-
no-sdl-gfx:: do not build modules which depend on SDL_gfx
|
67
|
-
no-sdl-image:: do not build modules which depend on SDL_image
|
68
|
-
no-sdl-mixer:: do not build modules which depend on SDL_mixer
|
69
|
-
no-sdl-ttf:: do not build modules which depend on SDL_ttf
|
70
|
-
no-opengl:: do not build modules which depend on OpenGL
|
71
|
-
|
72
|
-
no-sdl-config:: do not guess compiler/linker flags using `sdl-config'
|
73
|
-
|
74
|
-
debug:: build modules with debbugging flags enabled
|
75
|
-
universal:: on MacOS X, try to compile for both PPC and Intel
|
76
|
-
verbose:: display the build commands as they are run
|
39
|
+
The simplest way to install is with RubyGems:
|
77
40
|
|
78
|
-
|
79
|
-
In particular, CFLAGS and LDFLAGS are important for users compiling with
|
80
|
-
the no-sdl-config command.
|
41
|
+
$ sudo gem install rubygame
|
81
42
|
|
82
|
-
|
83
|
-
CFLAGS:: flags passed to the C compiler
|
84
|
-
LDSHARED:: linker command
|
85
|
-
LDFLAGS:: flags passed to the linker
|
86
|
-
RUBYARCHDIR:: where to install platform-specific compiled extensions
|
87
|
-
RUBYLIBDIR:: where to install platform-independent interpreted libs
|
43
|
+
Another way is to install directly from the source:
|
88
44
|
|
89
|
-
|
90
|
-
"no-*" flags for those libraries. For example, if you don't have SDL_gfx:
|
45
|
+
$ sudo rake install
|
91
46
|
|
92
|
-
|
47
|
+
Or generate and install a gem from the source:
|
93
48
|
|
94
|
-
|
95
|
-
|
96
|
-
automatically disable missing features.)
|
49
|
+
$ rake gem
|
50
|
+
$ sudo gem install pkg/rubygame-*.gem
|
97
51
|
|
98
52
|
=== Generating documentation
|
99
53
|
|
100
54
|
You can generate documentation for Rubygame's API by running:
|
101
55
|
|
102
|
-
|
56
|
+
$ rake rdoc
|
103
57
|
|
104
58
|
Documentation will be generated as HTML in the 'html' directory.
|
105
59
|
Open 'html/index.html' in a web browser to get started.
|
106
60
|
|
61
|
+
|
107
62
|
== Usage
|
108
63
|
|
109
64
|
See the documentation (online at http://docs.rubygame.org, or
|
110
65
|
generated locally with the 'rake rdoc' command).
|
111
66
|
|
112
67
|
We also recommend that you take a peek at the demo applications in
|
113
|
-
the 'samples' directory, especially
|
68
|
+
the 'samples' directory, especially image_viewer.rb,
|
69
|
+
demo_rubygame.rb, and chimp.rb.
|
70
|
+
|
71
|
+
|
72
|
+
== About the version number
|
73
|
+
|
74
|
+
The version number of Rubygame has a strict meaning, to help you
|
75
|
+
decide whether the new version might break your application. The
|
76
|
+
version number has 3 parts: the major number, the minor number, and
|
77
|
+
the patch number. For the example of Rubygame 2.6.0:
|
78
|
+
|
79
|
+
2 . 6 . 0
|
80
|
+
MAJOR . MINOR . PATCH
|
81
|
+
|
82
|
+
When a new release of Rubygame is made, one of the version numbers
|
83
|
+
will go up, and the numbers that come after it will be reset to 0.
|
84
|
+
Which number will go up depends on how much the Rubygame API changed:
|
85
|
+
|
86
|
+
- *MAJOR*: API has changed, and old apps _must_ be updated.
|
87
|
+
An example of this is when a class has been significantly changed,
|
88
|
+
or a method has renamed/moved to another module and the old name is
|
89
|
+
removed.
|
90
|
+
|
91
|
+
- *MINOR*: API has changed, but old apps will still work.
|
92
|
+
An example of this is when a new feature has been added, or a
|
93
|
+
method has been renamed but the old name is still supported.
|
94
|
+
|
95
|
+
- *PATCH*: API has not changed at all.
|
96
|
+
An example of this is when a bug has been fixed, or existing code
|
97
|
+
has been improved beneath the surface.
|
98
|
+
|
114
99
|
|
115
100
|
== License
|
116
101
|
|
117
102
|
Rubygame is distributed under the terms of the GNU Lesser GPL.
|
118
103
|
See LICENSE for more details.
|
119
104
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
Some of the sample files are distributed under licenses other than the
|
124
|
-
GNU Lesser GPL. See 'samples/README' and 'samples/GPL' for more details.
|
105
|
+
Some of the sample files are distributed under licenses other than
|
106
|
+
the GNU Lesser GPL. See 'samples/README' and 'samples/GPL' for more
|
107
|
+
details.
|
125
108
|
|
126
109
|
|
127
110
|
John Croisant (jacius at gmail.com)
|
data/ROADMAP
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
= ROADMAP
|
2
2
|
|
3
3
|
This represents the direction Rubygame will be going in, but
|
4
|
-
keep in mind that
|
4
|
+
keep in mind that plans and details may change over time.
|
5
5
|
|
6
6
|
|
7
|
-
== 2.X
|
7
|
+
== 2.X (_possible_ minor releases before 3.0)
|
8
8
|
|
9
9
|
=== Focus: Surface & Rect
|
10
10
|
|
11
11
|
- Surface improvements
|
12
12
|
- Make Surface instances copyable and marshalable
|
13
13
|
- Support for palettes on 8-bit Surfaces
|
14
|
+
- Export as OpenGL-ready 32bit pixel data.
|
14
15
|
- To Fix: New Surfaces never have alpha channels
|
15
|
-
- To Fix: Surface#set_at doesn't respect alpha
|
16
16
|
- To Add: Surface#pixels= (set pixel data directly)
|
17
17
|
- To Add: Surface.load_from_pixels (create from pixel data)
|
18
18
|
|
19
|
-
-
|
19
|
+
- Optimize Rect for speed
|
20
20
|
|
21
21
|
|
22
22
|
=== Focus: Sprites
|
@@ -24,18 +24,20 @@ keep in mind that specific details may change over time.
|
|
24
24
|
- New sprite system
|
25
25
|
- New Sprite, Scene, and Camera classes.
|
26
26
|
- More powerful and simpler to use.
|
27
|
-
- Integration with the Chipmunk physics library
|
27
|
+
- Integration with the Chipmunk physics library?
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
-
== 3.0
|
31
|
+
== 3.0 (next major release)
|
32
32
|
|
33
33
|
- Backwards compatibility is broken:
|
34
34
|
- Deprecated classes / methods retired:
|
35
35
|
- Rubygame::Mixer module.
|
36
36
|
- Rubygame::Mixer::Sample class. Use Rubygame::Sound.
|
37
37
|
- Rubygame::Mixer::Music class. Use Rubygame::Music.
|
38
|
-
- Rubygame::Surface.load_image method.
|
38
|
+
- Rubygame::Surface.load_image method. Use Rubygame::Surface.load.
|
39
|
+
- Rubygame::Ftor class. An alternative class will be provided.
|
40
|
+
- Rubygame::MediaBag class. Use Surface#[], Sound#[], and Music#[].
|
39
41
|
- Surface#get_at
|
40
42
|
- Sprites::Group#collide_group
|
41
43
|
|
@@ -44,7 +46,17 @@ keep in mind that specific details may change over time.
|
|
44
46
|
|
45
47
|
|
46
48
|
|
47
|
-
==
|
49
|
+
== Possible future developments
|
50
|
+
|
51
|
+
- Switch from SDL_gfx to SPriG for graphics primitives.
|
52
|
+
- SPriG provides more functionality and flexibility, and a more
|
53
|
+
consistent interface.
|
54
|
+
- How does speed compare?
|
55
|
+
- Is it buggy?
|
56
|
+
|
57
|
+
- Alternative back-ends:
|
58
|
+
- OpenGL (faster rendering, better Mac support)
|
59
|
+
- Allegro?
|
48
60
|
|
49
61
|
- Polygon, circle, and other geometric primitives
|
50
62
|
- Drawing, with styles?
|
@@ -65,8 +77,3 @@ keep in mind that specific details may change over time.
|
|
65
77
|
- E.g. moves a sprite from point A to point B over N seconds.
|
66
78
|
- Many types of effects, easy to define custom ones.
|
67
79
|
- Takes parameters: start/end time, others depending on effect.
|
68
|
-
|
69
|
-
- C equivalent of Rect.new_from_object (see rect.rb)
|
70
|
-
- Screen#update (cannot pass object with rect attribute)
|
71
|
-
- Screen#update_rects (same as above)
|
72
|
-
- Why not just call the ruby function from within C?
|
@@ -0,0 +1,79 @@
|
|
1
|
+
= Custom SDL Load Paths
|
2
|
+
|
3
|
+
In Rubygame 2.6 and later, you can tell Rubygame to look in custom
|
4
|
+
locations to find the SDL libraries (e.g. DLL files). This is mostly
|
5
|
+
intended for when you are packaging your application in a stand-alone
|
6
|
+
package (e.g. with RubyScript2Exe), and want to distribute the SDL
|
7
|
+
libraries with your application, so that users do not need to install
|
8
|
+
SDL.
|
9
|
+
|
10
|
+
== Setting Load Paths
|
11
|
+
|
12
|
+
Setting custom load paths is easy: just set the SDL_PATHS constant
|
13
|
+
to an Array of directories before you do `require "rubygame"`.
|
14
|
+
Note: You really must set SDL_PATHS *before* loading Rubygame!
|
15
|
+
|
16
|
+
Rubygame will look first in the paths in SDL_PATHS, in the order they
|
17
|
+
are given in the array. If Rubygame can't find a SDL library in any of
|
18
|
+
the SDL_PATHS directories, Rubygame will then search for the library
|
19
|
+
in some common library paths for the current operating system (e.g.
|
20
|
+
"C:\windows\system32\" on Windows, "/usr/lib/" on Linux, etc.).
|
21
|
+
|
22
|
+
For example, if the SDL libraries are in "mygame/libs/", and your
|
23
|
+
main script is "mygame/mygame.rb", you could do the following in
|
24
|
+
"mygame/mygame.rb":
|
25
|
+
|
26
|
+
main_dir = File.dirname(__FILE__)
|
27
|
+
SDL_PATHS = [ File.join( main_dir, "libs" ) ]
|
28
|
+
|
29
|
+
require "rubygame"
|
30
|
+
|
31
|
+
# ... the rest of your code ...
|
32
|
+
|
33
|
+
== Per-OS Load Paths
|
34
|
+
|
35
|
+
If you prefer to split the libraries into a separate directory for
|
36
|
+
each operating system, you can set SDL_PATHS to a Hash instead. For
|
37
|
+
example:
|
38
|
+
|
39
|
+
main_dir = File.dirname(__FILE__)
|
40
|
+
SDL_PATHS = {
|
41
|
+
/linux/ => File.join( main_dir, "libs", "linux" ),
|
42
|
+
/bsd/ => File.join( main_dir, "libs", "bsd" ),
|
43
|
+
/darwin/ => File.join( main_dir, "libs", "mac" ),
|
44
|
+
/windows/ => File.join( main_dir, "libs", "windows" ),
|
45
|
+
}
|
46
|
+
|
47
|
+
require "rubygame"
|
48
|
+
|
49
|
+
# ... the rest of your code ...
|
50
|
+
|
51
|
+
Each key in the hash should be a Regexp that matches an OS name. As of
|
52
|
+
this writing (October 2009), the list of recognized OS names is:
|
53
|
+
|
54
|
+
* "darwin" (MacOS X)
|
55
|
+
* "freebsd"
|
56
|
+
* "linux"
|
57
|
+
* "openbsd"
|
58
|
+
* "solaris"
|
59
|
+
* "windows"
|
60
|
+
|
61
|
+
== Library File Names
|
62
|
+
|
63
|
+
Rubygame has certain expectations about the names of library files for
|
64
|
+
each operating system ("[NAME]" is replaced with e.g. "SDL"):
|
65
|
+
|
66
|
+
'Nix:: lib[NAME].so
|
67
|
+
Mac:: lib[NAME].dylib or [NAME].framework/[NAME]
|
68
|
+
Windows:: [NAME].dll
|
69
|
+
|
70
|
+
The specific libraries used by Rubygame are:
|
71
|
+
|
72
|
+
SDL:: libSDL.so; libSDL.dylib or SDL.framework/SDL; SDL.dll
|
73
|
+
SDL_gfx:: libSDL_gfx.so; libSDL_gfx.dylib or SDL_gfx.framework/SDL_gfx; SDL_gfx.dll
|
74
|
+
SDL_image:: libSDL_image.so; libSDL_image.dylib or SDL_image.framework/SDL_image; SDL_image.dll
|
75
|
+
SDL_mixer:: libSDL_mixer.so; libSDL_mixer.dylib or SDL_mixer.framework/SDL_mixer; SDL_mixer.dll
|
76
|
+
SDL_ttf:: libSDL_ttf.so; libSDL_ttf.dylib or SDL_ttf.framework/SDL_ttf; SDL_ttf.dll
|
77
|
+
|
78
|
+
SDL is absolutely required. The others are optional, but strongly
|
79
|
+
recommended, because they provide a lot of extra functionality.
|