rubygame 2.5.3 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. data/CREDITS +6 -4
  2. data/NEWS +79 -0
  3. data/README +55 -72
  4. data/ROADMAP +20 -13
  5. data/doc/custom_sdl_load_paths.rdoc +79 -0
  6. data/doc/getting_started.rdoc +65 -36
  7. data/doc/keyboard_symbols.rdoc +243 -0
  8. data/doc/macosx_install.rdoc +49 -35
  9. data/doc/windows_install.rdoc +36 -108
  10. data/lib/rubygame.rb +62 -24
  11. data/lib/rubygame/audio.rb +147 -0
  12. data/lib/rubygame/clock.rb +164 -1
  13. data/lib/rubygame/color.rb +40 -7
  14. data/lib/rubygame/color/models/hsl.rb +1 -1
  15. data/lib/rubygame/color/models/hsv.rb +1 -1
  16. data/lib/rubygame/color/models/rgb.rb +1 -1
  17. data/lib/rubygame/color/palettes/css.rb +1 -3
  18. data/lib/rubygame/color/palettes/x11.rb +1 -2
  19. data/lib/rubygame/constants.rb +297 -0
  20. data/lib/rubygame/deprecated_mixer.rb +555 -0
  21. data/lib/rubygame/event.rb +122 -6
  22. data/lib/rubygame/event_handler.rb +3 -1
  23. data/lib/rubygame/event_hook.rb +6 -2
  24. data/lib/rubygame/event_triggers.rb +1 -1
  25. data/lib/rubygame/events.rb +416 -1
  26. data/lib/rubygame/ftor.rb +1 -7
  27. data/lib/rubygame/gfx.rb +583 -0
  28. data/lib/rubygame/gl.rb +107 -0
  29. data/lib/rubygame/image.rb +140 -0
  30. data/lib/rubygame/joystick.rb +184 -0
  31. data/lib/rubygame/main.rb +82 -0
  32. data/lib/rubygame/mediabag.rb +1 -1
  33. data/lib/rubygame/mixer.rb +30 -0
  34. data/lib/rubygame/music.rb +493 -0
  35. data/lib/rubygame/queue.rb +3 -1
  36. data/lib/rubygame/rect.rb +9 -9
  37. data/lib/rubygame/screen.rb +357 -0
  38. data/lib/rubygame/shared.rb +40 -4
  39. data/lib/rubygame/sound.rb +428 -0
  40. data/lib/rubygame/surface.rb +626 -0
  41. data/lib/rubygame/ttf.rb +311 -0
  42. data/samples/FreeSans.ttf +0 -0
  43. data/samples/README +6 -5
  44. data/samples/demo_draw.rb +1 -1
  45. data/samples/demo_gl.rb +3 -1
  46. data/samples/demo_gl_tex.rb +4 -2
  47. data/samples/demo_rubygame.rb +114 -105
  48. data/samples/demo_sfont.rb +1 -1
  49. data/samples/demo_ttf.rb +3 -1
  50. data/samples/demo_utf8.rb +1 -1
  51. data/samples/image_viewer.rb +118 -0
  52. data/samples/load_and_blit.rb +1 -1
  53. data/samples/rubygame.png +0 -0
  54. metadata +34 -40
  55. data/Rakefile +0 -537
  56. data/doc/extended_readme.rdoc +0 -49
  57. data/ext/body/rubygame_body.so +0 -0
  58. data/ext/rubygame/rubygame_clock.c +0 -301
  59. data/ext/rubygame/rubygame_clock.h +0 -32
  60. data/ext/rubygame/rubygame_event.c +0 -760
  61. data/ext/rubygame/rubygame_event.h +0 -48
  62. data/ext/rubygame/rubygame_event2.c +0 -661
  63. data/ext/rubygame/rubygame_event2.h +0 -29
  64. data/ext/rubygame/rubygame_gfx.c +0 -942
  65. data/ext/rubygame/rubygame_gfx.h +0 -101
  66. data/ext/rubygame/rubygame_gl.c +0 -154
  67. data/ext/rubygame/rubygame_gl.h +0 -32
  68. data/ext/rubygame/rubygame_image.c +0 -252
  69. data/ext/rubygame/rubygame_image.h +0 -41
  70. data/ext/rubygame/rubygame_joystick.c +0 -336
  71. data/ext/rubygame/rubygame_joystick.h +0 -41
  72. data/ext/rubygame/rubygame_main.c +0 -158
  73. data/ext/rubygame/rubygame_main.h +0 -36
  74. data/ext/rubygame/rubygame_mixer.c +0 -1024
  75. data/ext/rubygame/rubygame_mixer.h +0 -36
  76. data/ext/rubygame/rubygame_music.c +0 -1017
  77. data/ext/rubygame/rubygame_music.h +0 -29
  78. data/ext/rubygame/rubygame_screen.c +0 -572
  79. data/ext/rubygame/rubygame_screen.h +0 -45
  80. data/ext/rubygame/rubygame_shared.c +0 -269
  81. data/ext/rubygame/rubygame_shared.h +0 -69
  82. data/ext/rubygame/rubygame_sound.c +0 -863
  83. data/ext/rubygame/rubygame_sound.h +0 -29
  84. data/ext/rubygame/rubygame_surface.c +0 -1153
  85. data/ext/rubygame/rubygame_surface.h +0 -62
  86. data/ext/rubygame/rubygame_ttf.c +0 -599
  87. data/ext/rubygame/rubygame_ttf.h +0 -69
  88. data/samples/keys.rb +0 -52
@@ -0,0 +1,107 @@
1
+ #--
2
+ # Rubygame -- Ruby code and bindings to SDL to facilitate game creation
3
+ # Copyright (C) 2004-2009 John Croisant
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ #++
19
+
20
+
21
+
22
+ # The GL module provides an interface to SDL's OpenGL-related functions,
23
+ # allowing a Rubygame application to create hardware-accelerated 3D graphics
24
+ # with OpenGL.
25
+ #
26
+ # Please note that Rubygame itself does not provide an interface to OpenGL
27
+ # functions -- only functions which allow Rubygame to work together with
28
+ # OpenGL. You will need to use another library, for example
29
+ # ruby-opengl[http://ruby-opengl.rubyforge.org/],
30
+ # to actually create graphics with OpenGL.
31
+ #
32
+ # Users who wish to use Rubygame Surfaces as textures in OpenGL should
33
+ # see also the Surface#pixels method.
34
+ #
35
+ module Rubygame::GL
36
+
37
+
38
+ # Return the value of the the SDL/OpenGL attribute identified by +attrib+,
39
+ # which should be one of the constants defined in the Rubygame::GL module.
40
+ # See #set_attrib for a list of attribute constants.
41
+ #
42
+ # This method is useful after using #set_attrib and calling Screen#set_mode,
43
+ # to make sure the attribute is the expected value.
44
+ #
45
+ def self.get_attrib( attrib )
46
+ result = SDL.GL_GetAttribute(attrib)
47
+ if( result.nil? )
48
+ raise Rubygame::SDLError, "GL get attribute failed: #{SDL.GetError()}"
49
+ end
50
+ end
51
+
52
+
53
+
54
+ # Set the SDL/OpenGL attribute +attrib+ to +value+. This should be called
55
+ # *before* you call Screen#set_mode with the OPENGL flag. You may wish to
56
+ # use #get_attrib after calling Screen#set_mode to confirm that the attribute
57
+ # is set to the desired value.
58
+ #
59
+ # The full list of SDL/OpenGL attribute identifier constants (located under
60
+ # the Rubygame::GL module) is as follows:
61
+ #
62
+ # RED_SIZE:: Size of framebuffer red component, in bits.
63
+ # GREEN_SIZE:: Size of framebuffer green component, in bits.
64
+ # BLUE_SIZE:: Size of framebuffer blue component, in bits.
65
+ # ALPHA_SIZE:: Size of framebuffer alpha (opacity) component, in bits.
66
+ # BUFFER_SIZE:: Size of framebuffer, in bits.
67
+ # DOUBLEBUFFER:: Enable or disable double-buffering.
68
+ # DEPTH_SIZE:: Size of depth buffer, in bits.
69
+ # STENCIL_SIZE:: Size of stencil buffer, in bits.
70
+ # ACCUM_RED_SIZE:: Size of accumulation buffer red component, in bits.
71
+ # ACCUM_GREEN_SIZE:: Size of accumulation buffer green component, in bits.
72
+ # ACCUM_BLUE_SIZE:: Size of accumulation buffer blue component, in bits.
73
+ # ACCUM_ALPHA_SIZE:: Size of accumulation buffer alpha component, in bits.
74
+ #
75
+ def self.set_attrib( attrib, value )
76
+ result = SDL.GL_SetAttribute( attrib, value )
77
+ if( result == -1 )
78
+ raise Rubygame::SDLError, "GL set attribute failed: #{SDL.GetError()}"
79
+ end
80
+ end
81
+
82
+
83
+
84
+ # Swap the back and front buffers, for double-buffered OpenGL displays.
85
+ # Should be safe to use (albeit with no effect) on single-buffered OpenGL
86
+ # displays.
87
+ #
88
+ def self.swap_buffers
89
+ SDL.GL_SwapBuffers()
90
+ end
91
+
92
+
93
+ RED_SIZE = SDL::GL_RED_SIZE
94
+ GREEN_SIZE = SDL::GL_GREEN_SIZE
95
+ BLUE_SIZE = SDL::GL_BLUE_SIZE
96
+ ALPHA_SIZE = SDL::GL_ALPHA_SIZE
97
+ BUFFER_SIZE = SDL::GL_BUFFER_SIZE
98
+ DOUBLEBUFFER = SDL::GL_DOUBLEBUFFER
99
+ DEPTH_SIZE = SDL::GL_DEPTH_SIZE
100
+ STENCIL_SIZE = SDL::GL_STENCIL_SIZE
101
+ ACCUM_RED_SIZE = SDL::GL_ACCUM_RED_SIZE
102
+ ACCUM_GREEN_SIZE = SDL::GL_ACCUM_GREEN_SIZE
103
+ ACCUM_BLUE_SIZE = SDL::GL_ACCUM_BLUE_SIZE
104
+ ACCUM_ALPHA_SIZE = SDL::GL_ACCUM_ALPHA_SIZE
105
+
106
+
107
+ end
@@ -0,0 +1,140 @@
1
+ #--
2
+ # Rubygame -- Ruby code and bindings to SDL to facilitate game creation
3
+ # Copyright (C) 2004-2009 John Croisant
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ #++
19
+
20
+
21
+
22
+ require "ruby-sdl-ffi/image"
23
+
24
+ Rubygame::VERSIONS[:sdl_image] = SDL::Image.Linked_Version().to_ary
25
+
26
+
27
+ class Rubygame::Surface
28
+
29
+ class << self
30
+
31
+ # Searches each directory in Surface.autoload_dirs for a file with
32
+ # the given filename. If it finds that file, loads it and returns
33
+ # a Surface instance. If it doesn't find the file, returns nil.
34
+ #
35
+ # See Rubygame::NamedResource for more information about this
36
+ # functionality.
37
+ #
38
+ def autoload( name )
39
+ path = find_file( name )
40
+
41
+ if( path )
42
+ return load( path )
43
+ else
44
+ return nil
45
+ end
46
+ end
47
+
48
+
49
+ # *IMPORTANT*: this method only exists if SDL_image is available!
50
+ # Your code should check "defined?(Rubygame::Surface.load) != nil"
51
+ # to see if you can use this method, or be prepared to rescue from
52
+ # NameError.
53
+ #
54
+ # Load an image file from the disk to a Surface. If the image has an alpha
55
+ # channel (e.g. PNG with transparency), the Surface will as well. If the
56
+ # image cannot be loaded (for example if the image format is unsupported),
57
+ # will raise SDLError.
58
+ #
59
+ # This method takes this argument:
60
+ # filename:: a string containing the relative or absolute path to the
61
+ # image file. The file must have the proper file extension,
62
+ # as it is used to determine image format.
63
+ #
64
+ # These formats may be supported, but some may not be available on a
65
+ # particular system.
66
+ # BMP:: "Windows Bitmap" format.
67
+ # GIF:: "Graphics Interchange Format."
68
+ # JPG:: "Independent JPEG Group" format.
69
+ # LBM:: "Linear Bitmap" format (?)
70
+ # PCX:: "PC Paintbrush" format
71
+ # PNG:: "Portable Network Graphics" format.
72
+ # PNM:: "Portable Any Map" format. (i.e., PPM, PGM, or PBM)
73
+ # TGA:: "Truevision TARGA" format.
74
+ # TIF:: "Tagged Image File Format"
75
+ # XCF:: "eXperimental Computing Facility" (GIMP native format).
76
+ # XPM:: "XPixMap" format.
77
+ #
78
+ def load( filename )
79
+ surf = SDL::Image.Load( filename )
80
+
81
+ if( surf.pointer.null? )
82
+ raise( Rubygame::SDLError, "Couldn't load image \"%s\": %s"%\
83
+ [filename, SDL.GetError()] )
84
+ end
85
+
86
+ return self.new(surf)
87
+ end
88
+
89
+
90
+ # Deprecated. Use Surface.load instead!
91
+ def load_image( filename )
92
+ Rubygame.deprecated( "Rubygame::Surface.load_image", "3.0" )
93
+ load( filename )
94
+ end
95
+
96
+
97
+ # *IMPORTANT*: this method only exists if SDL_image is available!
98
+ # Your code should check
99
+ # "defined?(Rubygame::Surface.load_from_string) != nil" to see if
100
+ # you can use this method, or be prepared to rescue from
101
+ # NameError.
102
+ #
103
+ # Load an image file from memory (in the form of the given data)
104
+ # to a Surface. If the image has an alpha channel (e.g. PNG with
105
+ # transparency), the Surface will as well. If the image cannot be
106
+ # loaded (for example if the image format is unsupported), will
107
+ # raise SDLError.
108
+ #
109
+ # This method takes these arguments:
110
+ # data:: a string containing the data for the image, such as
111
+ # IO::read would return.
112
+ # type:: The type of file that the image is (i.e. 'TGA'). Case is
113
+ # not important. If absent, the library will try to
114
+ # automatically detect the type.
115
+ #
116
+ # See Surface.load for a list of possible supported file types.
117
+ #
118
+ def load_from_string( data, type=nil )
119
+ raw = FFI::Buffer.new(:char, data.length)
120
+ raw.put_bytes(0, data)
121
+
122
+ rw = SDL.RWFromMem( raw, data.length )
123
+
124
+ surf = if type
125
+ SDL::Image.LoadTyped_RW(rw, 1, type)
126
+ else
127
+ SDL::Image.Load_RW(rw, 1)
128
+ end
129
+
130
+ if surf.pointer.null?
131
+ raise( Rubygame::SDLError,
132
+ "Couldn't load image from string: #{SDL.GetError()}" )
133
+ end
134
+
135
+ return new(surf)
136
+ end
137
+
138
+ end
139
+
140
+ end
@@ -0,0 +1,184 @@
1
+ #--
2
+ # Rubygame -- Ruby code and bindings to SDL to facilitate game creation
3
+ # Copyright (C) 2004-2009 John Croisant
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ #++
19
+
20
+
21
+
22
+ # The Joystick class interfaces with joysticks, gamepads, and other
23
+ # similar hardware devices used to play games. Each joystick may
24
+ # have zero or more #axes, #balls, #hats, and/or #buttons.
25
+ #
26
+ # After a Joystick object is successfully created, events for that
27
+ # Joystick will begin appearing on the EventQueue when a button is
28
+ # pressed or released, a control stick is moved, etc.
29
+ #
30
+ # You can use Joystick.activate_all to start receiving events for
31
+ # all joysticks (equivalent to creating them all individually with
32
+ # Joystick.new). You can use Joystick.deactivate_all to stop
33
+ # receiving events for all joysticks.
34
+ #
35
+ # As of Rubygame 2.4, these are the current, "new-style" Joystick
36
+ # event classes:
37
+ #
38
+ # * Events::JoystickAxisMoved
39
+ # * Events::JoystickButtonPressed
40
+ # * Events::JoystickButtonReleased
41
+ # * Events::JoystickBallMoved
42
+ # * Events::JoystickHatMoved
43
+ #
44
+ # These old Joystick-related events are deprecated and will be
45
+ # removed in Rubygame 3.0:
46
+ #
47
+ # * JoyAxisEvent
48
+ # * JoyBallEvent
49
+ # * JoyHatEvent
50
+ # * JoyDownEvent
51
+ # * JoyUpEvent
52
+ #
53
+ # For more information about "new-style" events, see
54
+ # EventQueue.enable_new_style_events.
55
+ #
56
+ class Rubygame::Joystick
57
+
58
+
59
+ # Returns the total number of joysticks detected on the system.
60
+ def self.num_joysticks
61
+ SDL.NumJoysticks()
62
+ end
63
+
64
+
65
+ # Returns the name of Nth joystick on the system. The name is
66
+ # implementation-dependent. See also #name.
67
+ #
68
+ def self.get_name( index )
69
+ SDL.JoystickName( index )
70
+ end
71
+
72
+
73
+ # Activate all joysticks on the system, equivalent to calling
74
+ # Joystick.new for every joystick available. This will allow
75
+ # joystick-related events to be sent to the EventQueue for all
76
+ # joysticks.
77
+ #
78
+ # Returns:: Array of zero or more Joysticks.
79
+ # May raise:: SDLError, if the joystick system could not be
80
+ # initialized.
81
+ #
82
+ def self.activate_all
83
+ # Initialize if it isn't already.
84
+ if( SDL.WasInit(SDL::INIT_JOYSTICK) == 0 )
85
+ if( SDL.Init(SDL::INIT_JOYSTICK) != 0 )
86
+ raise Rubygame::SDLError, "Could not initialize SDL joysticks."
87
+ end
88
+ end
89
+
90
+ # Collect Joystick instances in an Array
91
+ joysticks = []
92
+
93
+ num_joysticks.times do |i|
94
+ joysticks << new( i )
95
+ end
96
+
97
+ return joysticks
98
+ end
99
+
100
+
101
+ # Deactivate all joysticks on the system. This will stop all
102
+ # joystick-related events from being sent to the EventQueue.
103
+ #
104
+ def self.deactivate_all
105
+ # Return right away if it isn't active
106
+ return if( SDL.WasInit(SDL::INIT_JOYSTICK) == 0 )
107
+
108
+ num_joysticks.times do |i|
109
+ joy = SDL.JoystickOpen(i)
110
+ unless( joy.pointer.nil? )
111
+ SDL.JoystickClose( joy )
112
+ end
113
+ end
114
+
115
+ return nil
116
+ end
117
+
118
+
119
+ # Create and initialize an interface to the Nth joystick on the
120
+ # system. Raises SDLError if the joystick could not be opened.
121
+ #
122
+ def initialize( index )
123
+ @struct = SDL.JoystickOpen( index )
124
+ if( @struct.pointer.null? )
125
+ raise( Rubygame::SDLError, "Could not open joystick %d: %s"%
126
+ [index, SDL.GetError()] )
127
+ end
128
+ end
129
+
130
+
131
+ # Returns the index number of the Joystick, i.e. the identifier
132
+ # number of the joystick that this interface controls. This is the
133
+ # same number that was given to Joystick.new.
134
+ #
135
+ def index
136
+ SDL.JoystickIndex( @struct )
137
+ end
138
+
139
+
140
+ # Returns a String containing the name of the Joystick. The name is
141
+ # implementation-dependent. See also Joystick.get_name.
142
+ #
143
+ def name
144
+ SDL.JoystickName( self.index )
145
+ end
146
+
147
+
148
+ # Returns the number of axes (singular: axis) featured on the
149
+ # Joystick. Each control stick generally has two axes (X and Y),
150
+ # although there are other types of controls which are represented
151
+ # as one or more axes.
152
+ #
153
+ def axes
154
+ SDL.JoystickNumAxes( @struct )
155
+ end
156
+
157
+
158
+ # Returns the number of trackballs featured on the Joystick. A
159
+ # trackball is usually a small sphere which can be rotated in-place
160
+ # in any direction, registering relative movement along two axes.
161
+ #
162
+ def balls
163
+ SDL.JoystickNumBalls( @struct )
164
+ end
165
+
166
+
167
+ # Returns the number of hats featured on the Joystick. A hat is a
168
+ # switch which can be pushed in one of several directions, or
169
+ # centered.
170
+ #
171
+ def hats
172
+ SDL.JoystickNumHats( @struct )
173
+ end
174
+
175
+
176
+ # Returns the number of buttons featured on the Joystick. A button
177
+ # can be in one of two states: neutral, or pushed.
178
+ #
179
+ def buttons
180
+ SDL.JoystickNumButtons( @struct )
181
+ end
182
+
183
+
184
+ end
@@ -0,0 +1,82 @@
1
+ #--
2
+ # Rubygame -- Ruby code and bindings to SDL to facilitate game creation
3
+ # Copyright (C) 2004-2009 John Croisant
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ #++
19
+
20
+
21
+
22
+ require "ruby-sdl-ffi/sdl"
23
+
24
+
25
+ module Rubygame
26
+
27
+ VERSIONS = {
28
+ :rubygame => [2, 5, 3],
29
+ :sdl => SDL.Linked_Version().to_ary
30
+ }
31
+
32
+
33
+ # Initialize Rubygame. This should be called soon after you
34
+ # +require+ Rubygame, so that everything will work properly.
35
+ #
36
+ def self.init
37
+ if( SDL.Init(SDL::INIT_EVERYTHING) == 0 )
38
+ SDL.EnableUNICODE(1)
39
+ else
40
+ raise Rubygame::SDLError, "Could not initialize SDL: #{SDL.GetError()}"
41
+ end
42
+ end
43
+
44
+
45
+ # Quit Rubygame. This should be used before your program terminates,
46
+ # especially if you have been using a fullscreen Screen! (Otherwise,
47
+ # the desktop resolution might not revert to its previous setting on
48
+ # some platforms, and your users will be frustrated and confused!)
49
+ #
50
+ def self.quit
51
+ SDL.Quit
52
+ end
53
+
54
+
55
+
56
+ # Indicates that an SDL function failed.
57
+ class SDLError < RuntimeError
58
+ end
59
+
60
+
61
+
62
+ SWSURFACE = SDL::SWSURFACE
63
+ HWSURFACE = SDL::HWSURFACE
64
+ ASYNCBLIT = SDL::ASYNCBLIT
65
+ ANYFORMAT = SDL::ANYFORMAT
66
+ HWPALETTE = SDL::HWPALETTE
67
+ HWACCEL = SDL::HWACCEL
68
+ SRCCOLORKEY = SDL::SRCCOLORKEY
69
+ RLEACCELOK = SDL::RLEACCELOK
70
+ RLEACCEL = SDL::RLEACCEL
71
+ SRCALPHA = SDL::SRCALPHA
72
+ PREALLOC = SDL::PREALLOC
73
+
74
+ DOUBLEBUF = SDL::DOUBLEBUF
75
+ FULLSCREEN = SDL::FULLSCREEN
76
+ OPENGL = SDL::OPENGL
77
+ OPENGLBLIT = SDL::OPENGLBLIT
78
+ RESIZABLE = SDL::RESIZABLE
79
+ NOFRAME = SDL::NOFRAME
80
+
81
+
82
+ end