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
@@ -1,41 +0,0 @@
1
- /*
2
- * Rubygame -- Ruby code and bindings to SDL to facilitate game creation
3
- * Copyright (C) 2004-2007 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
- #ifndef _RUBYGAME_IMAGE_H
22
- #define _RUBYGAME_IMAGE_H
23
-
24
- #include "SDL_image.h"
25
-
26
- #ifndef SDL_IMAGE_MAJOR_VERSION
27
- #define SDL_IMAGE_MAJOR_VERSION 0
28
- #endif
29
-
30
- #ifndef SDL_IMAGE_MINOR_VERSION
31
- #define SDL_IMAGE_MINOR_VERSION 0
32
- #endif
33
-
34
- #ifndef SDL_IMAGE_PATCHLEVEL
35
- #define SDL_IMAGE_PATCHLEVEL 0
36
- #endif
37
-
38
- extern void Init_rubygame_image();
39
- extern VALUE rbgm_image_load(VALUE, VALUE);
40
-
41
- #endif
@@ -1,336 +0,0 @@
1
- /*--
2
- *
3
- * Rubygame -- Ruby code and bindings to SDL to facilitate game creation
4
- * Copyright (C) 2004-2007 John Croisant
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- *
20
- *++
21
- */
22
-
23
- #include "rubygame_shared.h"
24
- #include "rubygame_joystick.h"
25
-
26
- void Rubygame_Init_Joystick();
27
- VALUE cJoy;
28
-
29
- VALUE rbgm_joy_numjoysticks(VALUE);
30
- VALUE rbgm_joy_getname(VALUE, VALUE);
31
-
32
- VALUE rbgm_joystick_new(VALUE, VALUE);
33
-
34
- VALUE rbgm_joystick_index(VALUE);
35
- VALUE rbgm_joystick_name(VALUE);
36
- VALUE rbgm_joystick_numaxes(VALUE);
37
- VALUE rbgm_joystick_numballs(VALUE);
38
- VALUE rbgm_joystick_numhats(VALUE);
39
- VALUE rbgm_joystick_numbuttons(VALUE);
40
-
41
-
42
- /*
43
- * call-seq:
44
- * num_joysticks -> Integer
45
- *
46
- * Returns the total number of joysticks detected on the system.
47
- */
48
- VALUE rbgm_joy_numjoysticks( VALUE module )
49
- {
50
- return INT2FIX(SDL_NumJoysticks());
51
- }
52
-
53
- /*
54
- * call-seq:
55
- * get_name( n ) -> String
56
- *
57
- * Returns the name of nth joystick on the system, up to 1024
58
- * characters long. The name is implementation-dependent.
59
- * See also #name().
60
- */
61
- VALUE rbgm_joy_getname( VALUE module, VALUE joynum )
62
- {
63
- return rb_str_new2(SDL_JoystickName(NUM2INT(joynum)));
64
- }
65
-
66
-
67
- /*
68
- * Internal function to safely deallocate the joystick, that is,
69
- * only if SDL Joystick module is still initialised.
70
- */
71
- static void RBGM_JoystickClose(SDL_Joystick *joy)
72
- {
73
- if(SDL_WasInit(SDL_INIT_JOYSTICK))
74
- {
75
- SDL_JoystickClose(joy);
76
- }
77
- }
78
-
79
-
80
-
81
- /*
82
- * call-seq:
83
- * Joystick.activate_all() -> [joystick1, joystick2, ...]
84
- *
85
- * Activate all joysticks on the system, equivalent to calling
86
- * Joystick.new for every joystick available. This will allow
87
- * joystick-related events to be sent to the EventQueue for
88
- * all joysticks.
89
- *
90
- * Returns:: Array of zero or more Joysticks.
91
- *
92
- */
93
- VALUE rbgm_joystick_activateall(VALUE module)
94
- {
95
- /* Initialize if it isn't already. */
96
- if( !SDL_WasInit(SDL_INIT_JOYSTICK) )
97
- {
98
- if( SDL_Init(SDL_INIT_JOYSTICK) != 0 )
99
- {
100
- rb_raise( eSDLError, "Could not initialize SDL joystick." );
101
- }
102
- }
103
-
104
- int num_joysticks = SDL_NumJoysticks();
105
- int i = 0;
106
-
107
- /* Collect Joystick instances in an Array. */
108
- VALUE joysticks = rb_ary_new();
109
-
110
- for(; i < num_joysticks; ++i )
111
- {
112
- rb_ary_push( joysticks, rbgm_joystick_new(module, INT2NUM(i)) );
113
- }
114
-
115
- return joysticks;
116
- }
117
-
118
-
119
- /*
120
- * call-seq:
121
- * Joystick.deactivate_all()
122
- *
123
- * Deactivate all joysticks on the system. This will stop all
124
- * joystick-related events from being sent to the EventQueue.
125
- *
126
- */
127
- VALUE rbgm_joystick_deactivateall(VALUE module)
128
- {
129
- /* Return right away if it wasn't active. */
130
- if( !SDL_WasInit(SDL_INIT_JOYSTICK) )
131
- {
132
- return Qnil;
133
- }
134
-
135
- int num_joysticks = SDL_NumJoysticks();
136
- int i = 0;
137
- SDL_Joystick *joy;
138
-
139
- for(; i < num_joysticks; ++i )
140
- {
141
- joy = SDL_JoystickOpen(i);
142
- if(joy != NULL)
143
- {
144
- SDL_JoystickClose( joy );
145
- }
146
- }
147
-
148
- return Qnil;
149
- }
150
-
151
-
152
-
153
- /*
154
- * call-seq:
155
- * new( n ) -> Joystick
156
- *
157
- * Create and initialize an interface to the nth joystick on the
158
- * system. Raises SDLError if the joystick could not be opened.
159
- */
160
- VALUE rbgm_joystick_new( VALUE module, VALUE vindex )
161
- {
162
- VALUE self;
163
- SDL_Joystick *joy;
164
- int index;
165
-
166
- index = NUM2INT(vindex);
167
-
168
- joy = SDL_JoystickOpen(index);
169
- if(joy == NULL)
170
- {
171
- rb_raise(eSDLError,"Could not open joystick %d: %s",\
172
- index,SDL_GetError());
173
- }
174
- self = Data_Wrap_Struct(cJoy, 0, RBGM_JoystickClose, joy);
175
- return self;
176
- }
177
-
178
- /*
179
- * call-seq:
180
- * index -> Integer
181
- *
182
- * Returns the index number of the Joystick, i.e. the identifier number of the
183
- * joystick that this interface controls. This is the same number that was
184
- * given to #new().
185
- */
186
- VALUE rbgm_joystick_index( VALUE self )
187
- {
188
- SDL_Joystick *joy;
189
-
190
- Data_Get_Struct(self,SDL_Joystick,joy);
191
- return INT2FIX(SDL_JoystickIndex(joy));
192
- }
193
-
194
- /*
195
- * call-seq:
196
- * name -> String
197
- *
198
- * Returns a String containing the name of the Joystick, up to 1024
199
- * characters long. The name is implementation-dependent. See also
200
- * #get_name().
201
- */
202
- VALUE rbgm_joystick_name( VALUE self )
203
- {
204
- char *name;
205
- SDL_Joystick *joy;
206
- Uint8 index;
207
- int n;
208
- int size = 1024;
209
-
210
- Data_Get_Struct(self,SDL_Joystick,joy);
211
- index = SDL_JoystickIndex(joy);
212
- name = (char *)malloc(size);
213
- n = snprintf(name,size,"%s",SDL_JoystickName(index));
214
- return rb_str_new(name,n);
215
- }
216
-
217
- /*
218
- * call-seq:
219
- * axes -> Integer
220
- *
221
- * Returns the number of axes (singular: axis) featured on the Joystick. Each
222
- * control stick generally has two axes (X and Y), although there are other
223
- * types of controls which are represented as one or more axes. See also
224
- * #axis_state().
225
- */
226
- VALUE rbgm_joystick_numaxes( VALUE self )
227
- {
228
- SDL_Joystick *joy;
229
- Data_Get_Struct(self,SDL_Joystick,joy);
230
- return INT2FIX(SDL_JoystickNumAxes(joy));
231
- }
232
-
233
- /*
234
- * call-seq:
235
- * balls -> Integer
236
- *
237
- * Returns the number of trackballs featured on the Joystick. A trackball is
238
- * usually a small sphere which can be rotated in-place in any direction,
239
- * registering relative movement along two axes. See alse #ball_state().
240
- */
241
- VALUE rbgm_joystick_numballs( VALUE self )
242
- {
243
- SDL_Joystick *joy;
244
- Data_Get_Struct(self,SDL_Joystick,joy);
245
- return INT2FIX(SDL_JoystickNumBalls(joy));
246
- }
247
-
248
- /*
249
- * call-seq:
250
- * hats -> Integer
251
- *
252
- * Returns the number of hats featured on the Joystick. A hat is a switch
253
- * which can be pushed in one of several directions, or centered. See also
254
- * #hat_state().
255
- */
256
- VALUE rbgm_joystick_numhats( VALUE self )
257
- {
258
- SDL_Joystick *joy;
259
- Data_Get_Struct(self,SDL_Joystick,joy);
260
- return INT2FIX(SDL_JoystickNumHats(joy));
261
- }
262
-
263
- /*
264
- * call-seq:
265
- * buttons -> Integer
266
- *
267
- * Returns the number of buttons featured on the Joystick. A button can
268
- * be in one of two states: neutral, or pushed. See also #button_state()
269
- */
270
- VALUE rbgm_joystick_numbuttons( VALUE self )
271
- {
272
- SDL_Joystick *joy;
273
- Data_Get_Struct(self,SDL_Joystick,joy);
274
- SDL_JoystickUpdate();
275
- return INT2FIX(SDL_JoystickNumButtons(joy));
276
- }
277
-
278
-
279
- /* Document-class: Rubygame::Joystick
280
- *
281
- * The Joystick class interfaces with joysticks, gamepads, and other
282
- * similar hardware devices used to play games. Each joystick may
283
- * have zero or more #axes, #balls, #hats, and/or #buttons.
284
- *
285
- * After a Joystick object is successfully created, events for that
286
- * Joystick will begin appearing on the EventQueue when a button is
287
- * pressed or released, a control stick is moved, etc.
288
- *
289
- * You can use Joystick.activate_all to start receiving events for
290
- * all joysticks (equivalent to creating them all individually with
291
- * Joystick.new). You can use Joystick.deactivate_all to stop
292
- * receiving events for all joysticks.
293
- *
294
- * As of Rubygame 2.4, these are the current, "new-style" Joystick
295
- * event classes:
296
- *
297
- * * Events::JoystickAxisMoved
298
- * * Events::JoystickButtonPressed
299
- * * Events::JoystickButtonReleased
300
- * * Events::JoystickBallMoved
301
- * * Events::JoystickHatMoved
302
- *
303
- * These old Joystick-related events are deprecated and will be
304
- * removed in Rubygame 3.0:
305
- *
306
- * * JoyAxisEvent
307
- * * JoyBallEvent
308
- * * JoyHatEvent
309
- * * JoyDownEvent
310
- * * JoyUpEvent
311
- *
312
- * For more information about "new-style" events, see
313
- * EventQueue.enable_new_style_events.
314
- *
315
- */
316
- void Rubygame_Init_Joystick()
317
- {
318
- #if 0
319
- mRubygame = rb_define_module("Rubygame");
320
- #endif
321
-
322
- cJoy = rb_define_class_under(mRubygame,"Joystick",rb_cObject);
323
- rb_define_singleton_method(cJoy,"num_joysticks",rbgm_joy_numjoysticks,0);
324
- rb_define_singleton_method(cJoy,"get_name",rbgm_joy_getname,1);
325
-
326
- rb_define_singleton_method(cJoy,"activate_all",rbgm_joystick_activateall,0);
327
- rb_define_singleton_method(cJoy,"deactivate_all",rbgm_joystick_deactivateall,0);
328
-
329
- rb_define_singleton_method(cJoy,"new",rbgm_joystick_new,1);
330
- rb_define_method(cJoy,"index",rbgm_joystick_index,0);
331
- rb_define_method(cJoy,"name",rbgm_joystick_name,0);
332
- rb_define_method(cJoy,"axes",rbgm_joystick_numaxes,0);
333
- rb_define_method(cJoy,"balls",rbgm_joystick_numballs,0);
334
- rb_define_method(cJoy,"hats",rbgm_joystick_numhats,0);
335
- rb_define_method(cJoy,"buttons",rbgm_joystick_numbuttons,0);
336
- }
@@ -1,41 +0,0 @@
1
- /*
2
- * Rubygame -- Ruby code and bindings to SDL to facilitate game creation
3
- * Copyright (C) 2004-2007 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
- #ifndef _RUBYGAME_JOYSTICK_H
23
- #define _RUBYGAME_JOYSTICK_H
24
-
25
- extern void Rubygame_Init_Joystick();
26
-
27
- extern VALUE cJoy;
28
-
29
- extern VALUE rbgm_joy_numjoysticks(VALUE);
30
- extern VALUE rbgm_joy_getname(VALUE, VALUE);
31
-
32
- extern VALUE rbgm_joystick_new(VALUE, VALUE);
33
-
34
- extern VALUE rbgm_joystick_index(VALUE);
35
- extern VALUE rbgm_joystick_name(VALUE);
36
- extern VALUE rbgm_joystick_numaxes(VALUE);
37
- extern VALUE rbgm_joystick_numballs(VALUE);
38
- extern VALUE rbgm_joystick_numhats(VALUE);
39
- extern VALUE rbgm_joystick_numbuttons(VALUE);
40
-
41
- #endif
@@ -1,158 +0,0 @@
1
- /*
2
- *--
3
- * Rubygame -- Ruby code and bindings to SDL to facilitate game creation
4
- * Copyright (C) 2004-2007 John Croisant
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- *++
20
- */
21
-
22
- #include "rubygame_shared.h"
23
- #include "rubygame_main.h"
24
- #include "rubygame_event.h"
25
- #include "rubygame_event2.h"
26
- #include "rubygame_gl.h"
27
- #include "rubygame_joystick.h"
28
- #include "rubygame_screen.h"
29
- #include "rubygame_surface.h"
30
- #include "rubygame_clock.h"
31
-
32
- VALUE rbgm_init(VALUE);
33
- VALUE rbgm_quit(VALUE);
34
- void Define_Rubygame_Constants();
35
-
36
- /*
37
- * call-seq:
38
- * key_name(sym) -> string
39
- *
40
- * Given the sym of a key, returns a printable representation. This
41
- * differs from key2str in that this will return a printable string
42
- * for any key, even non-printable keys such as the arrow keys.
43
- *
44
- * This method may raise SDLError if the SDL video subsystem could
45
- * not be initialized for some reason.
46
- *
47
- * Example:
48
- * Rubygame.key_name( Rubygame::K_A ) # => "a"
49
- * Rubygame.key_name( Rubygame::K_RETURN ) # => "return"
50
- * Rubygame.key_name( Rubygame::K_LEFT ) # => "left"
51
- */
52
- VALUE rbgm_keyname(VALUE self, VALUE sym)
53
- {
54
- /* SDL_GetKeyName only works when video system has been initialized. */
55
- if( init_video_system() == 0 )
56
- {
57
- SDLKey key = NUM2INT(sym);
58
- char *result = SDL_GetKeyName(key);
59
- return rb_str_new2(result);
60
- }
61
- else
62
- {
63
- rb_raise(eSDLError,"Could not initialize SDL video subsystem.");
64
- return Qnil;
65
- }
66
- }
67
-
68
-
69
- /*
70
- * call-seq:
71
- * init -> nil
72
- *
73
- * Initialize Rubygame. This should be called soon after you +require+
74
- * Rubygame, so that everything will work properly.
75
- */
76
- VALUE rbgm_init(VALUE module)
77
- {
78
- if(SDL_Init(SDL_INIT_EVERYTHING)==0)
79
- {
80
- SDL_EnableUNICODE(1);
81
- return Qnil;
82
- }
83
- else
84
- {
85
- rb_raise(eSDLError,"Could not initialize SDL.");
86
- return Qnil; /* should never get here */
87
- }
88
- }
89
-
90
- /*
91
- * call-seq:
92
- * quit -> nil
93
- *
94
- * Quit Rubygame. This should be used before your program terminates,
95
- * especially if you have been using a fullscreen Screen! (Otherwise,
96
- * the desktop resolution might not revert to its previous setting on
97
- * some platforms, and your users will be frustrated and confused!)
98
- */
99
- VALUE rbgm_quit(VALUE module)
100
- {
101
- SDL_Quit();
102
- return Qnil;
103
- }
104
-
105
-
106
- void Init_rubygame_core()
107
- {
108
- Init_rubygame_shared();
109
-
110
- mRubygame = rb_define_module("Rubygame");
111
-
112
- rb_define_module_function(mRubygame,"init",rbgm_init,0);
113
- rb_define_module_function(mRubygame,"quit",rbgm_quit,0);
114
- rb_define_singleton_method(mRubygame,"key_name",rbgm_keyname, 1);
115
- cRect = rb_define_class_under(mRubygame,"Rect",rb_cArray);
116
-
117
- rb_hash_aset(rb_ivar_get(mRubygame,rb_intern("VERSIONS")),
118
- ID2SYM(rb_intern("rubygame")),
119
- rb_ary_new3(3,
120
- INT2NUM(RUBYGAME_MAJOR_VERSION),
121
- INT2NUM(RUBYGAME_MINOR_VERSION),
122
- INT2NUM(RUBYGAME_PATCHLEVEL)));
123
- rb_hash_aset(rb_ivar_get(mRubygame,rb_intern("VERSIONS")),
124
- ID2SYM(rb_intern("sdl")),
125
- rb_ary_new3(3,
126
- INT2NUM(SDL_MAJOR_VERSION),
127
- INT2NUM(SDL_MINOR_VERSION),
128
- INT2NUM(SDL_PATCHLEVEL)));
129
-
130
- Rubygame_Init_Clock();
131
- Rubygame_Init_Surface();
132
- Rubygame_Init_Screen();
133
- Rubygame_Init_Event();
134
- Rubygame_Init_Event2();
135
- Rubygame_Init_Joystick();
136
- Rubygame_Init_GL();
137
-
138
- /* Flags for subsystem initialization */
139
- rb_define_const(mRubygame,"INIT_TIMER",INT2NUM(SDL_INIT_TIMER));
140
- rb_define_const(mRubygame,"INIT_AUDIO",INT2NUM(SDL_INIT_AUDIO));
141
- rb_define_const(mRubygame,"INIT_VIDEO",INT2NUM(SDL_INIT_VIDEO));
142
- rb_define_const(mRubygame,"INIT_CDROM",INT2NUM(SDL_INIT_CDROM));
143
- rb_define_const(mRubygame,"INIT_JOYSTICK",INT2NUM(SDL_INIT_JOYSTICK));
144
- rb_define_const(mRubygame,"INIT_NOPARACHUTE",INT2NUM(SDL_INIT_NOPARACHUTE));
145
- rb_define_const(mRubygame,"INIT_EVENTTHREAD",UINT2NUM(SDL_INIT_EVENTTHREAD));
146
- rb_define_const(mRubygame,"INIT_EVERYTHING",UINT2NUM(SDL_INIT_EVERYTHING));
147
-
148
-
149
- /* Define fully opaque and full transparent (0 and 255) */
150
- rb_define_const(mRubygame,"ALPHA_OPAQUE",UINT2NUM(SDL_ALPHA_OPAQUE));
151
- rb_define_const(mRubygame,"ALPHA_TRANSPARENT",
152
- UINT2NUM(SDL_ALPHA_TRANSPARENT));
153
-
154
-
155
- /* Flags for palettes (?) */
156
- rb_define_const(mRubygame,"LOGPAL",UINT2NUM(SDL_LOGPAL));
157
- rb_define_const(mRubygame,"PHYSPAL",UINT2NUM(SDL_PHYSPAL));
158
- }