rubysdl 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.en +8 -0
- data/NEWS.ja +8 -0
- data/README.en +22 -15
- data/README.ja +31 -20
- data/depend +2 -0
- data/doc-en/event.rsd +3 -0
- data/doc-en/time.rsd +1 -1
- data/doc-en/video.rsd +8 -8
- data/doc.txt +32 -0
- data/doc/event.rsd +5 -0
- data/doc/opengl.rsd +160 -0
- data/doc/rsd.rb +4 -3
- data/doc/time.rsd +1 -1
- data/doc/video.rsd +8 -8
- data/extconf.rb +30 -15
- data/lib/sdl.rb +2 -1
- data/lib/sdl1_compatible.rb +20 -0
- data/mkpkg.sh +28 -0
- data/rubysdl.gemspec +21 -0
- data/rubysdl.h +1 -0
- data/rubysdl_cdrom.c +0 -10
- data/rubysdl_event.c +30 -11
- data/rubysdl_event_key.c +0 -5
- data/rubysdl_image.c +2 -2
- data/rubysdl_joystick.c +0 -18
- data/rubysdl_kanji.c +0 -5
- data/rubysdl_main.c +0 -2
- data/rubysdl_mixer.c +2 -18
- data/rubysdl_mouse.c +0 -4
- data/rubysdl_rwops.c +4 -0
- data/rubysdl_sdlskk.c +0 -3
- data/rubysdl_sge_video.c +0 -14
- data/rubysdl_smpeg.c +0 -1
- data/rubysdl_time.c +0 -10
- data/rubysdl_ttf.c +0 -3
- data/rubysdl_video.c +2 -30
- data/rubysdl_wm.c +0 -5
- data/sample/caption.rb +21 -0
- data/sge/INSTALL +72 -0
- data/sge/LICENSE +504 -0
- data/sge/Makefile +83 -0
- data/sge/Makefile.conf +63 -0
- data/sge/README +219 -0
- data/sge/Todo +7 -0
- data/sge/WhatsNew +224 -0
- data/sge/sge.h +31 -0
- data/sge/sge_blib.cpp +1939 -0
- data/sge/sge_blib.h +68 -0
- data/sge/sge_bm_text.cpp +451 -0
- data/sge/sge_bm_text.h +71 -0
- data/sge/sge_collision.cpp +388 -0
- data/sge/sge_collision.h +54 -0
- data/sge/sge_config.h +6 -0
- data/sge/sge_internal.h +152 -0
- data/sge/sge_misc.cpp +92 -0
- data/sge/sge_misc.h +37 -0
- data/sge/sge_primitives.cpp +2516 -0
- data/sge/sge_primitives.h +111 -0
- data/sge/sge_rotation.cpp +683 -0
- data/sge/sge_rotation.h +46 -0
- data/sge/sge_shape.cpp +762 -0
- data/sge/sge_shape.h +365 -0
- data/sge/sge_surface.cpp +1090 -0
- data/sge/sge_surface.h +100 -0
- data/sge/sge_textpp.cpp +785 -0
- data/sge/sge_textpp.h +270 -0
- data/sge/sge_tt_text.cpp +1456 -0
- data/sge/sge_tt_text.h +114 -0
- data/utils/buildtest.sh +29 -0
- data/win32/README.en.win32 +72 -0
- data/win32/README.ja.win32 +80 -0
- data/win32/install_rubysdl.rb +30 -0
- data/win32/mkpkg.sh +72 -0
- metadata +136 -113
- data/rubysdl_ref.en.html +0 -5879
- data/rubysdl_ref.en.rd +0 -6601
- data/rubysdl_ref.html +0 -6194
- data/rubysdl_ref.rd +0 -6950
data/rubysdl_image.c
CHANGED
@@ -25,7 +25,6 @@ static VALUE Surface_s_load(VALUE klass, VALUE filename)
|
|
25
25
|
{
|
26
26
|
SDL_Surface *surface;
|
27
27
|
|
28
|
-
rb_secure(4);
|
29
28
|
ExportFilenameStringValue(filename);
|
30
29
|
|
31
30
|
surface = IMG_Load(RSTRING_PTR(filename));
|
@@ -45,12 +44,13 @@ static VALUE Surface_s_loadFromIO(VALUE class,VALUE io)
|
|
45
44
|
rb_raise(eSDLError,"Couldn't load image from IO: %s",
|
46
45
|
SDL_GetError());
|
47
46
|
}
|
47
|
+
|
48
|
+
RB_GC_GUARD(guard);
|
48
49
|
return Surface_create(surface);
|
49
50
|
}
|
50
51
|
static VALUE Surface_s_loadFromString(VALUE class,VALUE str)
|
51
52
|
{
|
52
53
|
SDL_Surface *surface;
|
53
|
-
rb_secure(4);
|
54
54
|
SafeStringValue(str);
|
55
55
|
|
56
56
|
surface = IMG_Load_RW(SDL_RWFromConstMem(RSTRING_PTR(str),
|
data/rubysdl_joystick.c
CHANGED
@@ -70,7 +70,6 @@ static VALUE Joystick_s_alloc(VALUE klass)
|
|
70
70
|
static VALUE Joystick_initialize(VALUE self, VALUE index)
|
71
71
|
{
|
72
72
|
Joystick* joy = GetJoystick(self);
|
73
|
-
rb_secure(4);
|
74
73
|
|
75
74
|
joy->joystick = SDL_JoystickOpen(NUM2INT(index));
|
76
75
|
if( joy->joystick == NULL ){
|
@@ -83,13 +82,11 @@ static VALUE Joystick_initialize(VALUE self, VALUE index)
|
|
83
82
|
/* class methods */
|
84
83
|
static VALUE Joystick_s_poll(VALUE klass)
|
85
84
|
{
|
86
|
-
rb_secure(4);
|
87
85
|
return INT2BOOL(SDL_JoystickEventState(SDL_QUERY) == SDL_ENABLE);
|
88
86
|
}
|
89
87
|
|
90
88
|
static VALUE Joystick_s_set_poll(VALUE klass, VALUE poll)
|
91
89
|
{
|
92
|
-
rb_secure(4);
|
93
90
|
|
94
91
|
if(RTEST(poll))
|
95
92
|
SDL_JoystickEventState(SDL_ENABLE);
|
@@ -100,26 +97,22 @@ static VALUE Joystick_s_set_poll(VALUE klass, VALUE poll)
|
|
100
97
|
|
101
98
|
static VALUE Joystick_s_num(VALUE klass)
|
102
99
|
{
|
103
|
-
rb_secure(4);
|
104
100
|
return INT2FIX(SDL_NumJoysticks());
|
105
101
|
}
|
106
102
|
|
107
103
|
static VALUE Joystick_s_indexName(VALUE klass, VALUE index)
|
108
104
|
{
|
109
|
-
rb_secure(4);
|
110
105
|
return rb_str_new2(SDL_JoystickName(NUM2INT(index)));
|
111
106
|
}
|
112
107
|
|
113
108
|
static VALUE Joystick_s_open_p(VALUE klass, VALUE index)
|
114
109
|
{
|
115
|
-
rb_secure(4);
|
116
110
|
return INT2BOOL(SDL_JoystickOpened(NUM2INT(index)));
|
117
111
|
}
|
118
112
|
|
119
113
|
static VALUE Joystick_s_open(VALUE klass, VALUE index)
|
120
114
|
{
|
121
115
|
VALUE newobj;
|
122
|
-
rb_secure(4);
|
123
116
|
|
124
117
|
newobj = Joystick_s_alloc(klass);
|
125
118
|
Joystick_initialize(newobj, index);
|
@@ -128,7 +121,6 @@ static VALUE Joystick_s_open(VALUE klass, VALUE index)
|
|
128
121
|
|
129
122
|
static VALUE Joystick_s_update(VALUE klass)
|
130
123
|
{
|
131
|
-
rb_secure(4);
|
132
124
|
SDL_JoystickUpdate();
|
133
125
|
return Qnil;
|
134
126
|
}
|
@@ -137,7 +129,6 @@ static VALUE Joystick_s_update(VALUE klass)
|
|
137
129
|
static VALUE Joystick_close(VALUE self)
|
138
130
|
{
|
139
131
|
Joystick* joy;
|
140
|
-
rb_secure(4);
|
141
132
|
|
142
133
|
joy = GetJoystick(self);
|
143
134
|
SDL_JoystickClose(joy->joystick);
|
@@ -147,7 +138,6 @@ static VALUE Joystick_close(VALUE self)
|
|
147
138
|
static VALUE Joystick_index(VALUE self)
|
148
139
|
{
|
149
140
|
SDL_Joystick* joystick;
|
150
|
-
rb_secure(4);
|
151
141
|
|
152
142
|
joystick = Get_SDL_Joystick(self);
|
153
143
|
return INT2FIX(SDL_JoystickIndex(joystick));
|
@@ -156,7 +146,6 @@ static VALUE Joystick_index(VALUE self)
|
|
156
146
|
static VALUE Joystick_numAxes(VALUE self)
|
157
147
|
{
|
158
148
|
SDL_Joystick* joystick;
|
159
|
-
rb_secure(4);
|
160
149
|
|
161
150
|
joystick = Get_SDL_Joystick(self);
|
162
151
|
return INT2FIX(SDL_JoystickNumAxes(joystick));
|
@@ -165,7 +154,6 @@ static VALUE Joystick_numAxes(VALUE self)
|
|
165
154
|
static VALUE Joystick_numBalls(VALUE self)
|
166
155
|
{
|
167
156
|
SDL_Joystick *joystick;
|
168
|
-
rb_secure(4);
|
169
157
|
|
170
158
|
joystick = Get_SDL_Joystick(self);
|
171
159
|
return INT2FIX(SDL_JoystickNumBalls(joystick));
|
@@ -174,7 +162,6 @@ static VALUE Joystick_numBalls(VALUE self)
|
|
174
162
|
static VALUE Joystick_numHats(VALUE self)
|
175
163
|
{
|
176
164
|
SDL_Joystick *joystick;
|
177
|
-
rb_secure(4);
|
178
165
|
joystick = Get_SDL_Joystick(self);
|
179
166
|
return INT2FIX(SDL_JoystickNumHats(joystick));
|
180
167
|
}
|
@@ -182,7 +169,6 @@ static VALUE Joystick_numHats(VALUE self)
|
|
182
169
|
static VALUE Joystick_numButtons(VALUE self)
|
183
170
|
{
|
184
171
|
SDL_Joystick *joystick;
|
185
|
-
rb_secure(4);
|
186
172
|
|
187
173
|
joystick = Get_SDL_Joystick(self);
|
188
174
|
return INT2FIX(SDL_JoystickNumButtons(joystick));
|
@@ -191,7 +177,6 @@ static VALUE Joystick_numButtons(VALUE self)
|
|
191
177
|
static VALUE Joystick_getAxis(VALUE self, VALUE axis)
|
192
178
|
{
|
193
179
|
SDL_Joystick *joystick;
|
194
|
-
rb_secure(4);
|
195
180
|
|
196
181
|
joystick = Get_SDL_Joystick(self);
|
197
182
|
return INT2NUM(SDL_JoystickGetAxis(joystick, NUM2INT(axis)));
|
@@ -200,7 +185,6 @@ static VALUE Joystick_getAxis(VALUE self, VALUE axis)
|
|
200
185
|
static VALUE Joystick_getHat(VALUE self, VALUE hat)
|
201
186
|
{
|
202
187
|
SDL_Joystick *joystick;
|
203
|
-
rb_secure(4);
|
204
188
|
|
205
189
|
joystick = Get_SDL_Joystick(self);
|
206
190
|
return UINT2NUM(SDL_JoystickGetHat(joystick, NUM2INT(hat)));
|
@@ -209,7 +193,6 @@ static VALUE Joystick_getHat(VALUE self, VALUE hat)
|
|
209
193
|
static VALUE Joystick_getButton(VALUE self, VALUE button)
|
210
194
|
{
|
211
195
|
SDL_Joystick *joystick;
|
212
|
-
rb_secure(4);
|
213
196
|
|
214
197
|
joystick = Get_SDL_Joystick(self);
|
215
198
|
return INT2BOOL(SDL_JoystickGetButton(joystick, NUM2INT(button)));
|
@@ -220,7 +203,6 @@ static VALUE Joystick_getBall(VALUE self, VALUE ball)
|
|
220
203
|
SDL_Joystick *joystick;
|
221
204
|
int dx,dy;
|
222
205
|
|
223
|
-
rb_secure(4);
|
224
206
|
|
225
207
|
joystick = Get_SDL_Joystick(self);
|
226
208
|
if( SDL_JoystickGetBall(joystick, NUM2INT(ball), &dx, &dy) == -1 )
|
data/rubysdl_kanji.c
CHANGED
@@ -80,7 +80,6 @@ static VALUE Font_s_open(VALUE klass, VALUE filename, VALUE size)
|
|
80
80
|
{
|
81
81
|
Kanji_Font* font;
|
82
82
|
|
83
|
-
rb_secure(4);
|
84
83
|
ExportFilenameStringValue(filename);
|
85
84
|
|
86
85
|
font = Kanji_OpenFont(RSTRING_PTR(filename), NUM2INT(size));
|
@@ -92,7 +91,6 @@ static VALUE Font_close(VALUE self)
|
|
92
91
|
{
|
93
92
|
KFont* kfont;
|
94
93
|
|
95
|
-
rb_secure(4);
|
96
94
|
kfont = Get_KFont(self);
|
97
95
|
if (kfont->font)
|
98
96
|
Kanji_CloseFont(kfont->font);
|
@@ -116,7 +114,6 @@ static VALUE Font_getCodingSystem(VALUE self)
|
|
116
114
|
|
117
115
|
static VALUE Font_add(VALUE self, VALUE filename)
|
118
116
|
{
|
119
|
-
rb_secure(4);
|
120
117
|
ExportFilenameStringValue(filename);
|
121
118
|
if(Kanji_AddFont(Get_Kanji_Font(self), RSTRING_PTR(filename)) == -1)
|
122
119
|
rb_raise(eSDLError, "Couldn't use font: %s", RSTRING_PTR(filename));
|
@@ -126,7 +123,6 @@ static VALUE Font_add(VALUE self, VALUE filename)
|
|
126
123
|
static VALUE Font_textwidth(VALUE self, VALUE text)
|
127
124
|
{
|
128
125
|
Kanji_Font* font;
|
129
|
-
rb_secure(4);
|
130
126
|
font = Get_Kanji_Font(self);
|
131
127
|
ExportStringValueToEnc(text, get_enc(font));
|
132
128
|
return INT2FIX(Kanji_FontWidth(font, RSTRING_PTR(text)));
|
@@ -148,7 +144,6 @@ static void Font_put(VALUE self, VALUE surface, VALUE text,
|
|
148
144
|
{
|
149
145
|
SDL_Color color;
|
150
146
|
Kanji_Font* font;
|
151
|
-
rb_secure(4);
|
152
147
|
font = Get_Kanji_Font(self);
|
153
148
|
ExportStringValueToEnc(text, get_enc(font));
|
154
149
|
color.r = NUM2INT(r);color.g = NUM2INT(g); color.b = NUM2INT(b);
|
data/rubysdl_main.c
CHANGED
@@ -23,7 +23,6 @@
|
|
23
23
|
|
24
24
|
static VALUE sdl_s_init(VALUE mod, VALUE flags)
|
25
25
|
{
|
26
|
-
rb_secure(4);
|
27
26
|
if( SDL_Init(NUM2UINT(flags)) < 0 )
|
28
27
|
rb_raise(eSDLError, "Couldn't initialize SDL: %s", SDL_GetError());
|
29
28
|
return Qnil;
|
@@ -43,7 +42,6 @@ static VALUE sdl_s_inited_system(VALUE mod, VALUE flags)
|
|
43
42
|
|
44
43
|
static VALUE sdl_s_putenv(VALUE mod, VALUE var)
|
45
44
|
{
|
46
|
-
rb_secure(4);
|
47
45
|
SafeStringValue(var);
|
48
46
|
|
49
47
|
if( putenv(StringValueCStr(var)) < 0 ){
|
data/rubysdl_mixer.c
CHANGED
@@ -108,7 +108,6 @@ static VALUE Mixer_s_driverName(VALUE mod)
|
|
108
108
|
static VALUE Mixer_s_open(VALUE mod, VALUE frequency, VALUE format,
|
109
109
|
VALUE channels, VALUE chunksize)
|
110
110
|
{
|
111
|
-
rb_secure(4);
|
112
111
|
|
113
112
|
if(Mix_opened()){
|
114
113
|
rb_raise(eSDLError, "already initialize SDL::Mixer");
|
@@ -123,7 +122,6 @@ static VALUE Mixer_s_open(VALUE mod, VALUE frequency, VALUE format,
|
|
123
122
|
|
124
123
|
static VALUE Mixer_s_close(VALUE mod)
|
125
124
|
{
|
126
|
-
rb_secure(4);
|
127
125
|
Mix_CloseAudio();
|
128
126
|
return Qnil;
|
129
127
|
}
|
@@ -143,7 +141,6 @@ static VALUE Mixer_s_spec(VALUE mod)
|
|
143
141
|
|
144
142
|
static VALUE Mixer_s_allocateChannels(VALUE mod, VALUE numchannels)
|
145
143
|
{
|
146
|
-
rb_secure(4);
|
147
144
|
return INT2FIX( Mix_AllocateChannels(NUM2INT(numchannels)) );
|
148
145
|
}
|
149
146
|
|
@@ -151,7 +148,6 @@ static VALUE Mixer_s_allocateChannels(VALUE mod, VALUE numchannels)
|
|
151
148
|
static VALUE Mixer_s_playChannel(VALUE mod, VALUE channel, VALUE wave, VALUE loops)
|
152
149
|
{
|
153
150
|
int play_channel;
|
154
|
-
rb_secure(4);
|
155
151
|
|
156
152
|
play_channel = Mix_PlayChannel(NUM2INT(channel),
|
157
153
|
Get_Mix_Chunk(wave),
|
@@ -243,7 +239,6 @@ static VALUE Wave_s_load(VALUE class, VALUE filename)
|
|
243
239
|
{
|
244
240
|
Mix_Chunk *chunk;
|
245
241
|
|
246
|
-
rb_secure(4);
|
247
242
|
ExportFilenameStringValue(filename);
|
248
243
|
|
249
244
|
chunk = Mix_LoadWAV(RSTRING_PTR(filename));
|
@@ -268,7 +263,6 @@ static VALUE Wave_s_loadFromIO(VALUE class, VALUE io)
|
|
268
263
|
static VALUE Wave_s_loadFromString(VALUE class, VALUE str)
|
269
264
|
{
|
270
265
|
Mix_Chunk *wave;
|
271
|
-
rb_secure(4);
|
272
266
|
SafeStringValue(str);
|
273
267
|
|
274
268
|
wave = Mix_LoadWAV_RW(SDL_RWFromConstMem(RSTRING_PTR(str),
|
@@ -285,7 +279,6 @@ static VALUE Wave_s_loadFromString(VALUE class, VALUE str)
|
|
285
279
|
/* Volume setting functions and methods : volume in 0..128 */
|
286
280
|
static VALUE Mixer_s_setVolume(VALUE mod, VALUE channel, VALUE volume)
|
287
281
|
{
|
288
|
-
rb_secure(4);
|
289
282
|
return INT2FIX(Mix_Volume(NUM2INT(channel), NUM2INT(volume)));
|
290
283
|
}
|
291
284
|
|
@@ -297,28 +290,24 @@ static VALUE Wave_s_setVolume(VALUE self, VALUE volume)
|
|
297
290
|
/* Halt,Pause function */
|
298
291
|
static VALUE Mixer_s_halt(VALUE mod, VALUE channel)
|
299
292
|
{
|
300
|
-
rb_secure(4);
|
301
293
|
Mix_HaltChannel(NUM2INT(channel));
|
302
294
|
return Qnil;
|
303
295
|
}
|
304
296
|
|
305
297
|
static VALUE Mixer_s_pause(VALUE mod, VALUE channel)
|
306
298
|
{
|
307
|
-
rb_secure(4);
|
308
299
|
Mix_Pause(NUM2INT(channel));
|
309
300
|
return Qnil;
|
310
301
|
}
|
311
302
|
|
312
303
|
static VALUE Mixer_s_resume(VALUE mod, VALUE channel)
|
313
304
|
{
|
314
|
-
rb_secure(4);
|
315
305
|
Mix_Resume(NUM2INT(channel));
|
316
306
|
return Qnil;
|
317
307
|
}
|
318
308
|
|
319
309
|
static VALUE Mixer_s_pause_p(VALUE mod, VALUE channel)
|
320
310
|
{
|
321
|
-
rb_secure(4);
|
322
311
|
return INT2FIX(Mix_Paused(NUM2INT(channel)));
|
323
312
|
}
|
324
313
|
static VALUE Mixer_s_fadeOut(VALUE mod, VALUE channel, VALUE ms)
|
@@ -340,14 +329,12 @@ static VALUE Mixer_s_fading(VALUE mod, VALUE which)
|
|
340
329
|
#define MakeSimpleRubyFunc(rubyFunc, sdlFunc) \
|
341
330
|
static VALUE rubyFunc(VALUE mod) \
|
342
331
|
{ \
|
343
|
-
rb_secure(4); \
|
344
332
|
sdlFunc(); \
|
345
333
|
return Qnil; \
|
346
334
|
} \
|
347
335
|
|
348
336
|
static VALUE Mixer_s_playMusic(VALUE mod, VALUE music, VALUE loops)
|
349
337
|
{
|
350
|
-
rb_secure(4);
|
351
338
|
|
352
339
|
Mix_PlayMusic(Get_Mix_Music(music), NUM2INT(loops));
|
353
340
|
playing_music = music; /* to avoid gc problem */
|
@@ -356,7 +343,6 @@ static VALUE Mixer_s_playMusic(VALUE mod, VALUE music, VALUE loops)
|
|
356
343
|
|
357
344
|
static VALUE Mixer_s_fadeInMusic(VALUE mod, VALUE music, VALUE loops, VALUE ms)
|
358
345
|
{
|
359
|
-
rb_secure(4);
|
360
346
|
Mix_FadeInMusic(Get_Mix_Music(music), NUM2INT(loops), NUM2INT(ms));
|
361
347
|
playing_music = music; /* to avoid gc problem */
|
362
348
|
return Qnil;
|
@@ -364,14 +350,12 @@ static VALUE Mixer_s_fadeInMusic(VALUE mod, VALUE music, VALUE loops, VALUE ms)
|
|
364
350
|
|
365
351
|
static VALUE Mixer_s_setVolumeMusic(VALUE mod, VALUE volume)
|
366
352
|
{
|
367
|
-
rb_secure(4);
|
368
353
|
Mix_VolumeMusic( NUM2INT(volume) );
|
369
354
|
return Qnil;
|
370
355
|
}
|
371
356
|
|
372
357
|
static VALUE Mixer_s_fadeOutMusic(VALUE mod, VALUE ms)
|
373
358
|
{
|
374
|
-
rb_secure(4);
|
375
359
|
Mix_FadeOutMusic(NUM2INT(ms));
|
376
360
|
return Qnil;
|
377
361
|
}
|
@@ -400,7 +384,6 @@ static VALUE Music_s_load(VALUE class, VALUE filename)
|
|
400
384
|
{
|
401
385
|
Mix_Music* music;
|
402
386
|
|
403
|
-
rb_secure(4);
|
404
387
|
ExportFilenameStringValue(filename);
|
405
388
|
|
406
389
|
music = Mix_LoadMUS(RSTRING_PTR(filename));
|
@@ -429,7 +412,8 @@ static VALUE Mixer_s_loadMusFromString(VALUE class, VALUE str)
|
|
429
412
|
|
430
413
|
result = Music_create(music);
|
431
414
|
rb_iv_set(result, "buf", buf);
|
432
|
-
|
415
|
+
|
416
|
+
RB_GC_GUARD(result); RB_GC_GUARD(buf);
|
433
417
|
return result;
|
434
418
|
}
|
435
419
|
#endif
|
data/rubysdl_mouse.c
CHANGED
@@ -25,7 +25,6 @@ static VALUE Mouse_s_state(VALUE mod)
|
|
25
25
|
{
|
26
26
|
int x,y;
|
27
27
|
Uint8 result;
|
28
|
-
rb_secure(4);
|
29
28
|
result = SDL_GetMouseState(&x, &y);
|
30
29
|
return rb_ary_new3(5,INT2FIX(x), INT2FIX(y),
|
31
30
|
INT2BOOL(result&SDL_BUTTON_LMASK),
|
@@ -35,7 +34,6 @@ static VALUE Mouse_s_state(VALUE mod)
|
|
35
34
|
|
36
35
|
static VALUE Mouse_s_warp(VALUE mod, VALUE x, VALUE y)
|
37
36
|
{
|
38
|
-
rb_secure(4);
|
39
37
|
SDL_WarpMouse(NUM2UINT(x), NUM2UINT(y));
|
40
38
|
return Qnil;
|
41
39
|
}
|
@@ -45,7 +43,6 @@ static VALUE Mouse_s_setCursor_imp(VALUE mod,VALUE data,VALUE mask,VALUE w,
|
|
45
43
|
{
|
46
44
|
SDL_Cursor *new_cursor;
|
47
45
|
|
48
|
-
rb_secure(4);
|
49
46
|
SafeStringValue(data);
|
50
47
|
SafeStringValue(mask);
|
51
48
|
|
@@ -76,7 +73,6 @@ static VALUE Mouse_s_setCursor_imp(VALUE mod,VALUE data,VALUE mask,VALUE w,
|
|
76
73
|
|
77
74
|
static VALUE Mouse_s_show(VALUE mod)
|
78
75
|
{
|
79
|
-
rb_secure(4);
|
80
76
|
SDL_ShowCursor(1);
|
81
77
|
return Qnil;
|
82
78
|
}
|
data/rubysdl_rwops.c
CHANGED
@@ -27,6 +27,8 @@ static int rubyio_read(SDL_RWops* context, void* ptr, int size, int maxnum)
|
|
27
27
|
StringValue(str);
|
28
28
|
|
29
29
|
memcpy(ptr, RSTRING_PTR(str), RSTRING_LEN(str));
|
30
|
+
|
31
|
+
RB_GC_GUARD(io); RB_GC_GUARD(str);
|
30
32
|
return RSTRING_LEN(str)/size;
|
31
33
|
}
|
32
34
|
|
@@ -60,6 +62,8 @@ static int rubyio_pseudo_seek(SDL_RWops* context, int offset, int whence)
|
|
60
62
|
SDL_SetError("Unknown value for 'whence'");
|
61
63
|
return(-1);
|
62
64
|
}
|
65
|
+
|
66
|
+
RB_GC_GUARD(io); RB_GC_GUARD(str);
|
63
67
|
return NUM2INT(rb_funcall(io, rb_intern("tell"), 0));
|
64
68
|
}
|
65
69
|
|
data/rubysdl_sdlskk.c
CHANGED
@@ -185,7 +185,6 @@ static VALUE Dictionary_s_new(VALUE klass)
|
|
185
185
|
static VALUE Dictionary_load(VALUE self, VALUE filename, VALUE users)
|
186
186
|
{
|
187
187
|
SDLSKK_Dictionary* dict = Get_SDLSKK_Dictionary(self);
|
188
|
-
rb_secure(4);
|
189
188
|
ExportFilenameStringValue(filename);
|
190
189
|
|
191
190
|
if(!SDLSKK_Dict_load(dict, RSTRING_PTR(filename), RTEST(users)))
|
@@ -197,7 +196,6 @@ static VALUE Dictionary_load(VALUE self, VALUE filename, VALUE users)
|
|
197
196
|
static VALUE Dictionary_save(VALUE self, VALUE filename)
|
198
197
|
{
|
199
198
|
SDLSKK_Dictionary* dict = Get_SDLSKK_Dictionary(self);
|
200
|
-
rb_secure(4);
|
201
199
|
ExportFilenameStringValue(filename);
|
202
200
|
|
203
201
|
if(!SDLSKK_Dict_save_user_dict(dict, RSTRING_PTR(filename)))
|
@@ -208,7 +206,6 @@ static VALUE Dictionary_save(VALUE self, VALUE filename)
|
|
208
206
|
static VALUE RomKanaRuleTable_s_new(VALUE klass, VALUE table_file)
|
209
207
|
{
|
210
208
|
SDLSKK_RomKanaRuleTable* rule_table;
|
211
|
-
rb_secure(4);
|
212
209
|
ExportFilenameStringValue(table_file);
|
213
210
|
|
214
211
|
rule_table = SDLSKK_RomKanaRuleTable_new(RSTRING_PTR(table_file));
|
data/rubysdl_sge_video.c
CHANGED
@@ -55,20 +55,17 @@ static VALUE BMFont_create(sge_bmpFont* font)
|
|
55
55
|
|
56
56
|
static VALUE Surface_s_autoLock_p(VALUE klass)
|
57
57
|
{
|
58
|
-
rb_secure(4);
|
59
58
|
return INT2BOOL(sge_getLock());
|
60
59
|
}
|
61
60
|
|
62
61
|
static VALUE Surface_s_autoLockON(VALUE klass)
|
63
62
|
{
|
64
|
-
rb_secure(4);
|
65
63
|
sge_Lock_ON();
|
66
64
|
return Qnil;
|
67
65
|
}
|
68
66
|
|
69
67
|
static VALUE Surface_s_autoLockOFF(VALUE klass)
|
70
68
|
{
|
71
|
-
rb_secure(4);
|
72
69
|
sge_Lock_OFF();
|
73
70
|
return Qnil;
|
74
71
|
}
|
@@ -80,7 +77,6 @@ static VALUE Surface_drawLine(int argc, VALUE* argv, VALUE self)
|
|
80
77
|
Uint32 color;
|
81
78
|
SDL_Surface* surface;
|
82
79
|
|
83
|
-
rb_secure(4);
|
84
80
|
rb_scan_args(argc, argv, "52", &x1_, &y1_, &x2_, &y2_, &color_, &aa_, &alpha_);
|
85
81
|
surface = Get_SDL_Surface(self);
|
86
82
|
|
@@ -139,7 +135,6 @@ static VALUE Surface_drawCircle(int argc, VALUE* argv, VALUE self)
|
|
139
135
|
Sint16 x, y, r;
|
140
136
|
Uint32 color;
|
141
137
|
|
142
|
-
rb_secure(4);
|
143
138
|
rb_scan_args(argc, argv, "43", &x_, &y_, &r_, &color_, &fill_, &aa_, &alpha_);
|
144
139
|
|
145
140
|
surface = Get_SDL_Surface(self);
|
@@ -183,7 +178,6 @@ static VALUE Surface_drawEllipse(int argc, VALUE* argv, VALUE self)
|
|
183
178
|
Sint16 x, y, rx, ry;
|
184
179
|
Uint32 color;
|
185
180
|
|
186
|
-
rb_secure(4);
|
187
181
|
rb_scan_args(argc, argv, "53", &x_, &y_, &rx_, &ry_, &color_,
|
188
182
|
&fill_, &aa_, &alpha_);
|
189
183
|
|
@@ -231,7 +225,6 @@ static VALUE Surface_drawBezier(int argc, VALUE* argv, VALUE self)
|
|
231
225
|
int level;
|
232
226
|
int i;
|
233
227
|
|
234
|
-
rb_secure(4);
|
235
228
|
/* WARNING: third argument of rb_scan_args
|
236
229
|
should be 10-2, but rb_scan_args cannot accept such
|
237
230
|
an argument.
|
@@ -290,7 +283,6 @@ static VALUE Surface_s_transformDraw(VALUE klass, VALUE src, VALUE dst,
|
|
290
283
|
VALUE qx, VALUE qy,
|
291
284
|
VALUE flags)
|
292
285
|
{
|
293
|
-
rb_secure(4);
|
294
286
|
sge_transform(Get_SDL_Surface(src), Get_SDL_Surface(dst),
|
295
287
|
NUM2DBL(angle), NUM2DBL(xscale), NUM2DBL(yscale),
|
296
288
|
NUM2INT(px), NUM2INT(py), NUM2INT(qx), NUM2INT(qy),
|
@@ -303,7 +295,6 @@ static VALUE Surface_transform(VALUE self, VALUE bgcolor, VALUE angle,
|
|
303
295
|
{
|
304
296
|
SDL_Surface *surface, *result;
|
305
297
|
|
306
|
-
rb_secure(4);
|
307
298
|
surface = Get_SDL_Surface(self);
|
308
299
|
result = sge_transform_surface(surface, VALUE2COLOR(bgcolor, surface->format),
|
309
300
|
NUM2DBL(angle), NUM2DBL(xscale),
|
@@ -316,7 +307,6 @@ static VALUE Surface_transform(VALUE self, VALUE bgcolor, VALUE angle,
|
|
316
307
|
static VALUE Surface_makeCollisionMap(VALUE self)
|
317
308
|
{
|
318
309
|
sge_cdata * cdata;
|
319
|
-
rb_secure(4);
|
320
310
|
cdata = sge_make_cmap(Get_SDL_Surface(self));
|
321
311
|
if(cdata == NULL)
|
322
312
|
rb_raise(eSDLError, "Couldn't Create CollisionMap: %s", SDL_GetError());
|
@@ -370,7 +360,6 @@ static VALUE CollisionMap_set(VALUE self, VALUE vx, VALUE vy, VALUE vw, VALUE vh
|
|
370
360
|
sge_cdata * cdata = Get_sge_cdata(self);
|
371
361
|
Sint16 x, y, w, h;
|
372
362
|
|
373
|
-
rb_secure(4);
|
374
363
|
x = NUM2INT(vx);
|
375
364
|
y = NUM2INT(vy);
|
376
365
|
w = NUM2INT(vw);
|
@@ -387,7 +376,6 @@ static VALUE CollisionMap_clear(VALUE self, VALUE vx, VALUE vy, VALUE vw, VALUE
|
|
387
376
|
sge_cdata * cdata = Get_sge_cdata(self);
|
388
377
|
Sint16 x, y, w, h;
|
389
378
|
|
390
|
-
rb_secure(4);
|
391
379
|
x = NUM2INT(vx);
|
392
380
|
y = NUM2INT(vy);
|
393
381
|
w = NUM2INT(vw);
|
@@ -415,7 +403,6 @@ static VALUE BMFont_open(VALUE klass, VALUE file, VALUE flags)
|
|
415
403
|
|
416
404
|
{
|
417
405
|
sge_bmpFont* font;
|
418
|
-
rb_secure(4);
|
419
406
|
ExportFilenameStringValue(file);
|
420
407
|
|
421
408
|
font = sge_BF_OpenFont(RSTRING_PTR(file), NUM2UINT(flags));
|
@@ -468,7 +455,6 @@ static VALUE BMFont_textout(VALUE self,
|
|
468
455
|
VALUE x, VALUE y)
|
469
456
|
|
470
457
|
{
|
471
|
-
rb_secure(4);
|
472
458
|
SafeStringValue(string);
|
473
459
|
|
474
460
|
sge_BF_textout(Get_SDL_Surface(surface), Get_sge_bmpFont(self),
|