rubygame 2.2.0 → 2.3.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.
- data/NEWS +55 -4
- data/README +23 -39
- data/ROADMAP +85 -19
- data/Rakefile +49 -20
- data/doc/windows_install.rdoc +1 -1
- data/ext/rubygame/rubygame_image.c +145 -1
- data/ext/rubygame/rubygame_main.h +6 -3
- data/ext/rubygame/rubygame_mixer.c +323 -63
- data/ext/rubygame/rubygame_mixer.h +5 -31
- data/ext/rubygame/rubygame_music.c +1017 -0
- data/ext/rubygame/rubygame_music.h +29 -0
- data/ext/rubygame/rubygame_shared.c +63 -0
- data/ext/rubygame/rubygame_shared.h +8 -0
- data/ext/rubygame/rubygame_sound.c +863 -0
- data/ext/rubygame/rubygame_sound.h +29 -0
- data/ext/rubygame/rubygame_surface.c +4 -0
- data/lib/rubygame/color/models/base.rb +5 -0
- data/lib/rubygame/named_resource.rb +254 -0
- data/samples/chimp.rb +52 -63
- data/samples/demo_gl.rb +0 -0
- data/samples/demo_gl_tex.rb +0 -0
- data/samples/demo_music.rb +10 -8
- data/samples/demo_rubygame.rb +15 -3
- data/samples/demo_sfont.rb +0 -0
- data/samples/demo_ttf.rb +0 -0
- data/samples/demo_utf8.rb +0 -0
- metadata +55 -45
- data/ext/rubygame/MANIFEST +0 -25
- data/lib/rubygame/MANIFEST +0 -12
@@ -0,0 +1,29 @@
|
|
1
|
+
/*
|
2
|
+
* Interface to SDL_mixer music playback and mixing.
|
3
|
+
*--
|
4
|
+
* Rubygame -- Ruby code and bindings to SDL to facilitate game creation
|
5
|
+
* Copyright (C) 2004-2008 John Croisant
|
6
|
+
*
|
7
|
+
* This library is free software; you can redistribute it and/or
|
8
|
+
* modify it under the terms of the GNU Lesser General Public
|
9
|
+
* License as published by the Free Software Foundation; either
|
10
|
+
* version 2.1 of the License, or (at your option) any later version.
|
11
|
+
*
|
12
|
+
* This library is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15
|
+
* Lesser General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Lesser General Public
|
18
|
+
* License along with this library; if not, write to the Free Software
|
19
|
+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
20
|
+
*++
|
21
|
+
*/
|
22
|
+
|
23
|
+
|
24
|
+
#ifndef _RUBYGAME_MUSIC_H
|
25
|
+
#define _RUBYGAME_MUSIC_H
|
26
|
+
|
27
|
+
extern void Rubygame_Init_Music();
|
28
|
+
|
29
|
+
#endif
|
@@ -26,6 +26,9 @@ VALUE mRubygame;
|
|
26
26
|
VALUE cSurface;
|
27
27
|
VALUE cRect;
|
28
28
|
VALUE eSDLError;
|
29
|
+
VALUE mNamedResource;
|
30
|
+
|
31
|
+
|
29
32
|
SDL_Rect *make_rect(int, int, int, int);
|
30
33
|
SDL_Color make_sdl_color(VALUE);
|
31
34
|
int init_video_system();
|
@@ -42,11 +45,31 @@ SDL_Rect *make_rect(int x, int y, int w, int h)
|
|
42
45
|
return rect;
|
43
46
|
}
|
44
47
|
|
48
|
+
/* Returns a symbol from the given char* string */
|
45
49
|
VALUE make_symbol(char *string)
|
46
50
|
{
|
47
51
|
return ID2SYM(rb_intern(string));
|
48
52
|
}
|
49
53
|
|
54
|
+
/* Returns a char* string from the given symbol */
|
55
|
+
char *unmake_symbol(VALUE symbol)
|
56
|
+
{
|
57
|
+
return rb_id2name( SYM2ID(symbol) );
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
/* Lowercase, change spaces to underscores, and convert to symbol.
|
62
|
+
* Equivalent to: str.downcase!.gsub!(" ","_").intern
|
63
|
+
*/
|
64
|
+
VALUE sanitized_symbol(char *string)
|
65
|
+
{
|
66
|
+
VALUE str = rb_str_new2(string);
|
67
|
+
|
68
|
+
rb_funcall( str, rb_intern("downcase!"), 0 );
|
69
|
+
rb_funcall( str, rb_intern("gsub!"), 2, rb_str_new2(" "), rb_str_new2("_") );
|
70
|
+
return rb_funcall( str, rb_intern("intern"), 0 );
|
71
|
+
}
|
72
|
+
|
50
73
|
/* Take either nil, Numeric or an Array of Numerics, returns Uint32. */
|
51
74
|
Uint32 collapse_flags(VALUE vflags)
|
52
75
|
{
|
@@ -148,6 +171,23 @@ void extract_rgba_u8_as_u8(VALUE color, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
|
|
148
171
|
}
|
149
172
|
}
|
150
173
|
|
174
|
+
|
175
|
+
|
176
|
+
/* --
|
177
|
+
*
|
178
|
+
* Issues a deprecation warning for the given feature/method.
|
179
|
+
*
|
180
|
+
* ++
|
181
|
+
*/
|
182
|
+
void rg_deprecated( char *feature, char *version )
|
183
|
+
{
|
184
|
+
rb_warning( "%s is DEPRECATED and will be removed in Rubygame %s! "
|
185
|
+
"Please see the docs for more information.",
|
186
|
+
feature, version );
|
187
|
+
}
|
188
|
+
|
189
|
+
|
190
|
+
|
151
191
|
/* --
|
152
192
|
*
|
153
193
|
* call-seq:
|
@@ -172,6 +212,20 @@ int init_video_system()
|
|
172
212
|
}
|
173
213
|
}
|
174
214
|
|
215
|
+
/* --
|
216
|
+
*
|
217
|
+
* Includes the Rubygame::NamedResource mixin in the given class
|
218
|
+
* and performs the `included' callback.
|
219
|
+
*
|
220
|
+
* ++
|
221
|
+
*/
|
222
|
+
void rg_include_named_resource( VALUE klass )
|
223
|
+
{
|
224
|
+
/* Include the mixin, and manually perform the 'included' callback. */
|
225
|
+
rb_include_module( klass, mNamedResource );
|
226
|
+
rb_funcall( mNamedResource, rb_intern("included"), 1, klass );
|
227
|
+
}
|
228
|
+
|
175
229
|
|
176
230
|
void Init_rubygame_shared()
|
177
231
|
{
|
@@ -206,4 +260,13 @@ void Init_rubygame_shared()
|
|
206
260
|
* compile-time dependencies. */
|
207
261
|
rb_define_const(mRubygame,"VERSIONS",rb_hash_new());
|
208
262
|
}
|
263
|
+
|
264
|
+
|
265
|
+
/* Rubygame::NamedResource mixin. See named_resource.rb. */
|
266
|
+
if( mNamedResource == (int)NULL )
|
267
|
+
{
|
268
|
+
rb_require("rubygame/named_resource");
|
269
|
+
mNamedResource = rb_const_get(mRubygame, rb_intern("NamedResource"));
|
270
|
+
}
|
271
|
+
|
209
272
|
}
|
@@ -30,9 +30,12 @@ extern VALUE mRubygame;
|
|
30
30
|
extern VALUE eSDLError;
|
31
31
|
extern VALUE cSurface;
|
32
32
|
extern VALUE cRect;
|
33
|
+
extern VALUE mNamedResource;
|
33
34
|
|
34
35
|
extern SDL_Rect *make_rect(int, int, int, int);
|
35
36
|
extern VALUE make_symbol(char *);
|
37
|
+
extern char *unmake_symbol(VALUE);
|
38
|
+
extern VALUE sanitized_symbol(char *);
|
36
39
|
extern Uint32 collapse_flags(VALUE);
|
37
40
|
extern VALUE convert_to_array(VALUE);
|
38
41
|
|
@@ -40,6 +43,11 @@ extern SDL_Color make_sdl_color(VALUE);
|
|
40
43
|
extern void extract_rgb_u8_as_u8(VALUE, Uint8*, Uint8*, Uint8*);
|
41
44
|
extern void extract_rgba_u8_as_u8(VALUE, Uint8*, Uint8*, Uint8*, Uint8*);
|
42
45
|
|
46
|
+
extern void rg_deprecated( char *feature, char *version );
|
47
|
+
|
48
|
+
/* Properly includes the Rubygame::NamedResource mixin in the klass */
|
49
|
+
extern void rg_include_named_resource( VALUE klass );
|
50
|
+
|
43
51
|
extern int init_video_system();
|
44
52
|
extern void Init_rubygame_shared();
|
45
53
|
|