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/doc/rsd.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
#!ruby
|
2
|
+
# -*- coding: euc-jp -*-
|
2
3
|
|
3
4
|
class Hash
|
4
5
|
def hash_map
|
@@ -37,7 +38,7 @@ def rsd2rd(input)
|
|
37
38
|
part = Hash.new{""}
|
38
39
|
mode = nil
|
39
40
|
|
40
|
-
input.
|
41
|
+
input.each_line do |line|
|
41
42
|
case line
|
42
43
|
when /^(MOD|DEP|NAME|PURPOSE|TYPE|RVAL|OBSOLETE)\s+/
|
43
44
|
part[$1] = $'.chomp
|
@@ -69,7 +70,7 @@ def rsd2rd(input)
|
|
69
70
|
output = ""
|
70
71
|
ns = if part.key?("MOD") then "SDL::#{part["MOD"]}" else "SDL" end
|
71
72
|
|
72
|
-
part["PROTO"].
|
73
|
+
part["PROTO"].each_line{|proto| output << "--- #{ns}#{part["TYPE"]}#{proto}"}
|
73
74
|
output << "\n"
|
74
75
|
if part.key?("OBSOLETE")
|
75
76
|
if $english
|
data/doc/time.rsd
CHANGED
data/doc/video.rsd
CHANGED
@@ -2445,8 +2445,8 @@ LOCK
|
|
2445
2445
|
PURPOSE ľ�������褷�ޤ���
|
2446
2446
|
|
2447
2447
|
PROTO
|
2448
|
-
draw_line(x1,x2,
|
2449
|
-
drawLine(x1,x2,
|
2448
|
+
draw_line(x1,y1,x2,y2,color, aa=false, alpha=nil)
|
2449
|
+
drawLine(x1,y1,x2,y2,color, aa=false, alpha=nil)
|
2450
2450
|
|
2451
2451
|
DESC
|
2452
2452
|
($[x1], $[y1])����($[x2], $[y2])�ޤǤ�ľ���� $[color]
|
@@ -2467,8 +2467,8 @@ LOCK
|
|
2467
2467
|
PURPOSE ����������ꥢ�����줿ľ�������褷�ޤ���
|
2468
2468
|
|
2469
2469
|
PROTO
|
2470
|
-
draw_aa_line(x1,x2,
|
2471
|
-
drawAALine(x1,x2,
|
2470
|
+
draw_aa_line(x1,y1,x2,y2,color)
|
2471
|
+
drawAALine(x1,y1,x2,y2,color)
|
2472
2472
|
|
2473
2473
|
OBSOLETE Surface#draw_line
|
2474
2474
|
DESC
|
@@ -2488,8 +2488,8 @@ PURPOSE
|
|
2488
2488
|
OBSOLETE Surface#draw_line
|
2489
2489
|
|
2490
2490
|
PROTO
|
2491
|
-
draw_line_alpha(x1,x2,
|
2492
|
-
drawLineAlpha(x1,x2,
|
2491
|
+
draw_line_alpha(x1,y1,x2,y2,color,alpha)
|
2492
|
+
drawLineAlpha(x1,y1,x2,y2,color,alpha)
|
2493
2493
|
|
2494
2494
|
DESC
|
2495
2495
|
($[x1], $[y1])����($[x2], $[y2])�ޤǤ�ľ���� $[color] �ǻ��ꤷ������
|
@@ -2508,8 +2508,8 @@ PURPOSE
|
|
2508
2508
|
OBSOLETE Surface#draw_line
|
2509
2509
|
|
2510
2510
|
PROTO
|
2511
|
-
draw_aa_line_alpha(x1,x2,
|
2512
|
-
drawAALineAlpha(x1,x2,
|
2511
|
+
draw_aa_line_alpha(x1,y1,x2,y2,color,alpha)
|
2512
|
+
drawAALineAlpha(x1,y1,x2,y2,color,alpha)
|
2513
2513
|
|
2514
2514
|
DESC
|
2515
2515
|
($[x1], $[y1])����($[x2], $[y2])�ޤǤ�ľ���� $[color] �ǻ��ꤷ������
|
data/extconf.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'mkmf'
|
2
2
|
|
3
|
+
$srcs = Dir.glob(File.join($srcdir, "*.c"))
|
3
4
|
if /mswin32/ =~ CONFIG["arch"]
|
4
5
|
have_library("SDL")
|
5
6
|
else
|
6
7
|
sdl_config = with_config('sdl-config', 'sdl-config')
|
7
|
-
|
8
|
-
$CFLAGS += ' ' + `#{sdl_config} --cflags`.chomp
|
8
|
+
$CPPFLAGS += " " + `#{sdl_config} --cflags`.chomp
|
9
9
|
$LOCAL_LIBS += ' ' + `#{sdl_config} --libs`.chomp
|
10
10
|
|
11
|
-
if /-Dmain=SDL_main/ =~ $
|
11
|
+
if /-Dmain=SDL_main/ =~ $CPPFLAGS then
|
12
12
|
def try_func(func, libs, headers = nil, &b)
|
13
13
|
headers = cpp_include(headers)
|
14
14
|
try_link(<<"SRC", libs, &b) or try_link(<<"SRC", libs, &b)
|
@@ -44,24 +44,29 @@ if enable_config("static-libs",false) then
|
|
44
44
|
end
|
45
45
|
|
46
46
|
if have_library("smpeg","SMPEG_new") then
|
47
|
-
$
|
47
|
+
$CPPFLAGS+= " -D HAVE_SMPEG "
|
48
48
|
smpeg_config = with_config('smpeg-config', 'smpeg-config')
|
49
49
|
if system(smpeg_config, "--version")
|
50
|
-
$
|
50
|
+
$CPPFLAGS += ' ' + `#{smpeg_config} --cflags`.chomp
|
51
51
|
$LOCAL_LIBS += ' ' + `#{smpeg_config} --libs`.chomp
|
52
52
|
end
|
53
53
|
end
|
54
54
|
if have_library("SDL_mixer","Mix_OpenAudio") then
|
55
|
-
$
|
56
|
-
end
|
57
|
-
if have_library("SGE","sge_Line") then
|
58
|
-
$CFLAGS+= " -D HAVE_SGE "
|
55
|
+
$CPPFLAGS+= " -D HAVE_SDL_MIXER "
|
59
56
|
end
|
60
57
|
if have_library("SDL_image","IMG_Load") then
|
61
|
-
$
|
58
|
+
$CPPFLAGS+= " -D HAVE_SDL_IMAGE "
|
62
59
|
end
|
63
60
|
if have_library("SDL_ttf","TTF_Init") then
|
64
|
-
$
|
61
|
+
$CPPFLAGS+= " -D HAVE_SDL_TTF "
|
62
|
+
end
|
63
|
+
use_imported_sge = enable_config("imported-sge", false)
|
64
|
+
if use_imported_sge
|
65
|
+
$CPPFLAGS+= " -Isge -D HAVE_SGE "
|
66
|
+
else
|
67
|
+
if have_library("SGE","sge_Line") then
|
68
|
+
$CPPFLAGS+= " -D HAVE_SGE "
|
69
|
+
end
|
65
70
|
end
|
66
71
|
|
67
72
|
have_func("TTF_OpenFontIndex")
|
@@ -71,22 +76,26 @@ have_func("TTF_FontFaceFamilyName")
|
|
71
76
|
have_func("TTF_FontFaceStyleName")
|
72
77
|
have_func("Mix_LoadMUS_RW")
|
73
78
|
have_func("rb_thread_blocking_region")
|
79
|
+
if have_header("ruby/thread.h")
|
80
|
+
have_func("rb_thread_call_without_gvl")
|
81
|
+
end
|
82
|
+
|
74
83
|
if enable_config("m17n", true)
|
75
84
|
if have_func("rb_enc_str_new") && have_func("rb_str_export_to_enc")
|
76
|
-
$
|
85
|
+
$CPPFLAGS += " -D ENABLE_M17N "
|
77
86
|
if enable_config("m17n-filesystem", false)
|
78
|
-
$
|
87
|
+
$CPPFLAGS += " -D ENABLE_M17N_FILESYSTEM "
|
79
88
|
end
|
80
89
|
end
|
81
90
|
end
|
82
91
|
|
83
92
|
if have_library("SDLSKK","SDLSKK_Context_new") then
|
84
|
-
$
|
93
|
+
$CPPFLAGS+= " -D HAVE_SDLSKK "
|
85
94
|
end
|
86
95
|
if enable_config("opengl",true) then
|
87
96
|
dir_config('x11','/usr/X11R6')
|
88
97
|
|
89
|
-
$
|
98
|
+
$CPPFLAGS+= " -D ENABLE_OPENGL "
|
90
99
|
|
91
100
|
if /linux/ =~ CONFIG["arch"] then
|
92
101
|
have_library("GL","glVertex3d")
|
@@ -95,5 +104,11 @@ if enable_config("opengl",true) then
|
|
95
104
|
have_library("glu32","gluGetString")
|
96
105
|
end
|
97
106
|
end
|
107
|
+
|
108
|
+
if use_imported_sge
|
109
|
+
$srcs += Dir.glob(File.join($srcdir, "sge/*.cpp"))
|
110
|
+
$objs = $srcs.map{|fname| fname.sub(/\.(c|cpp)\Z/, ".o") }
|
111
|
+
end
|
112
|
+
|
98
113
|
create_makefile("sdl_ext")
|
99
114
|
|
data/lib/sdl.rb
CHANGED
@@ -18,7 +18,7 @@ require 'sdl_ext'
|
|
18
18
|
require 'forwardable'
|
19
19
|
|
20
20
|
module SDL
|
21
|
-
VERSION = "2.1.
|
21
|
+
VERSION = "2.1.3"
|
22
22
|
|
23
23
|
class Surface
|
24
24
|
def put(surface,x,y)
|
@@ -183,6 +183,7 @@ module SDL
|
|
183
183
|
module_eval(<<-EOS)
|
184
184
|
def draw#{t}(dst, text, x, y, #{args})
|
185
185
|
image = render#{t}(text, #{args})
|
186
|
+
return if image.nil?
|
186
187
|
dst.put(image, x, y)
|
187
188
|
image.destroy
|
188
189
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
module SDL
|
3
|
+
module_function
|
4
|
+
|
5
|
+
def setVideoMode(*args)
|
6
|
+
SDL::Screen.open(*args)
|
7
|
+
end
|
8
|
+
def blitSurface(*args)
|
9
|
+
SDL::Screen.blit(*args)
|
10
|
+
end
|
11
|
+
|
12
|
+
class Surface
|
13
|
+
extend Forwardable
|
14
|
+
def_delegators :format, :mapRGB, :mapRGBA, :getRGB, :getRGBA
|
15
|
+
def_delegators :format, :bpp, :colorkey, :alpha
|
16
|
+
def_delegators :format, :Rmask, :Gmask, :Bmask, :Amask
|
17
|
+
end
|
18
|
+
|
19
|
+
Event2 = Event
|
20
|
+
end
|
data/mkpkg.sh
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
if [ "$1" = "" ];then
|
4
|
+
echo "Usage: $0 VERSION [TAG]"
|
5
|
+
exit 1
|
6
|
+
fi
|
7
|
+
VERSION=$1
|
8
|
+
|
9
|
+
if [ "$2" = "" ];then
|
10
|
+
TAG=$VERSION
|
11
|
+
else
|
12
|
+
TAG=$2
|
13
|
+
fi
|
14
|
+
|
15
|
+
PACKAGE=rubysdl-$VERSION.tar.gz
|
16
|
+
DIRNAME=rubysdl-$VERSION
|
17
|
+
|
18
|
+
git archive --format=tar --prefix=$DIRNAME/ $TAG | tar xf -
|
19
|
+
|
20
|
+
export RBENV_VERSION=system
|
21
|
+
LANG=ja_JP.eucJP make -C $DIRNAME/doc
|
22
|
+
make install -C $DIRNAME/doc
|
23
|
+
make -C $DIRNAME/doc-en
|
24
|
+
make install -C $DIRNAME/doc-en
|
25
|
+
|
26
|
+
|
27
|
+
tar czf $PACKAGE $DIRNAME/*
|
28
|
+
rm -r $DIRNAME
|
data/rubysdl.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- Ruby -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "rubysdl"
|
5
|
+
spec.version = "2.1.3"
|
6
|
+
spec.summary = "The simple ruby extension library to use SDL"
|
7
|
+
spec.description = <<-EOS
|
8
|
+
Ruby/SDL is an extension library to use SDL(Simple DirectMedia
|
9
|
+
Layer). This library enables you to control audio, keyboard,
|
10
|
+
mouse, joystick, 3D hardware via OpenGL, and 2D video
|
11
|
+
framebuffer. Ruby/SDL is used by games and visual demos.
|
12
|
+
EOS
|
13
|
+
spec.rubyforge_project = "rubysdl"
|
14
|
+
spec.author = "Ohbayashi Ippei"
|
15
|
+
spec.email = "ohai@kmc.gr.jp"
|
16
|
+
spec.homepage = "http://www.kmc.gr.jp/~ohai/"
|
17
|
+
spec.files = `git ls-files`.split(/\n/)
|
18
|
+
spec.test_files = []
|
19
|
+
spec.extensions = ["extconf.rb"]
|
20
|
+
spec.has_rdoc = false
|
21
|
+
end
|
data/rubysdl.h
CHANGED
data/rubysdl_cdrom.c
CHANGED
@@ -52,7 +52,6 @@ static VALUE CD_s_alloc(VALUE klass)
|
|
52
52
|
static VALUE CD_initialize(VALUE self, VALUE drive)
|
53
53
|
{
|
54
54
|
CD* cd = GetCD(self);
|
55
|
-
rb_secure(4);
|
56
55
|
|
57
56
|
cd->cd = SDL_CDOpen(NUM2INT(drive));
|
58
57
|
if(cd->cd == NULL)
|
@@ -63,12 +62,10 @@ static VALUE CD_initialize(VALUE self, VALUE drive)
|
|
63
62
|
|
64
63
|
static VALUE CD_s_numDrive(VALUE klass)
|
65
64
|
{
|
66
|
-
rb_secure(4);
|
67
65
|
return INT2FIX(SDL_CDNumDrives());
|
68
66
|
}
|
69
67
|
static VALUE CD_s_name(VALUE klass, VALUE drive)
|
70
68
|
{
|
71
|
-
rb_secure(4);
|
72
69
|
return rb_str_new2(SDL_CDName(NUM2INT(drive)));
|
73
70
|
}
|
74
71
|
static VALUE CD_s_open(VALUE klass, VALUE drive)
|
@@ -79,12 +76,10 @@ static VALUE CD_s_open(VALUE klass, VALUE drive)
|
|
79
76
|
}
|
80
77
|
static VALUE CD_status(VALUE self)
|
81
78
|
{
|
82
|
-
rb_secure(4);
|
83
79
|
return INT2FIX(SDL_CDStatus(Get_SDL_CD(self)));
|
84
80
|
}
|
85
81
|
static VALUE CD_play(VALUE self, VALUE start, VALUE length)
|
86
82
|
{
|
87
|
-
rb_secure(4);
|
88
83
|
if( SDL_CDPlay(Get_SDL_CD(self), NUM2INT(start), NUM2INT(length))==-1 )
|
89
84
|
rb_raise(eSDLError, "Couldn't play cd :%s", SDL_GetError() );
|
90
85
|
return Qnil;
|
@@ -92,7 +87,6 @@ static VALUE CD_play(VALUE self, VALUE start, VALUE length)
|
|
92
87
|
static VALUE CD_playTracks(VALUE self, VALUE start_track, VALUE start_frame,
|
93
88
|
VALUE ntracks, VALUE nframes)
|
94
89
|
{
|
95
|
-
rb_secure(4);
|
96
90
|
if( SDL_CDPlayTracks(Get_SDL_CD(self), NUM2INT(start_track),
|
97
91
|
NUM2INT(start_frame), NUM2INT(ntracks),
|
98
92
|
NUM2INT(nframes))==-1 )
|
@@ -101,28 +95,24 @@ static VALUE CD_playTracks(VALUE self, VALUE start_track, VALUE start_frame,
|
|
101
95
|
}
|
102
96
|
static VALUE CD_pause(VALUE self)
|
103
97
|
{
|
104
|
-
rb_secure(4);
|
105
98
|
if( SDL_CDPause(Get_SDL_CD(self))==-1 )
|
106
99
|
rb_raise(eSDLError, "cd pause failed :%s", SDL_GetError());
|
107
100
|
return Qnil;
|
108
101
|
}
|
109
102
|
static VALUE CD_resume(VALUE self)
|
110
103
|
{
|
111
|
-
rb_secure(4);
|
112
104
|
if( SDL_CDResume(Get_SDL_CD(self))==-1 )
|
113
105
|
rb_raise(eSDLError, "cd resume failed :%s", SDL_GetError());
|
114
106
|
return Qnil;
|
115
107
|
}
|
116
108
|
static VALUE CD_stop(VALUE self)
|
117
109
|
{
|
118
|
-
rb_secure(4);
|
119
110
|
if( SDL_CDStop(Get_SDL_CD(self))==-1 )
|
120
111
|
rb_raise(eSDLError, "cd pause failed :%s", SDL_GetError());
|
121
112
|
return Qnil;
|
122
113
|
}
|
123
114
|
static VALUE CD_eject(VALUE self)
|
124
115
|
{
|
125
|
-
rb_secure(4);
|
126
116
|
if( SDL_CDEject(Get_SDL_CD(self))==-1 )
|
127
117
|
rb_raise(eSDLError, "cd eject failed :%s", SDL_GetError());
|
128
118
|
return Qnil;
|
data/rubysdl_event.c
CHANGED
@@ -19,6 +19,9 @@
|
|
19
19
|
*/
|
20
20
|
|
21
21
|
#include "rubysdl.h"
|
22
|
+
#ifdef HAVE_RUBY_THREAD_H
|
23
|
+
#include <ruby/thread.h>
|
24
|
+
#endif
|
22
25
|
|
23
26
|
static VALUE cEvent;
|
24
27
|
static VALUE cActiveEvent;
|
@@ -176,29 +179,48 @@ static VALUE createVideoResizeEvent(SDL_Event *event)
|
|
176
179
|
static VALUE Event_s_poll(VALUE class)
|
177
180
|
{
|
178
181
|
SDL_Event event;
|
179
|
-
rb_secure(4);
|
180
182
|
if( SDL_PollEvent(&event) == 1)
|
181
183
|
return event_creators[event.type](&event);
|
182
184
|
else
|
183
185
|
return Qnil;
|
184
186
|
}
|
185
|
-
|
187
|
+
|
188
|
+
#if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
|
189
|
+
static void* wait_event(void* ev)
|
190
|
+
{
|
191
|
+
return (void*)(intptr_t)SDL_WaitEvent((SDL_Event*)ev);
|
192
|
+
}
|
193
|
+
#elif defined(HAVE_RB_THREAD_BLOCKING_REGION)
|
186
194
|
static VALUE wait_event(void* ev)
|
187
195
|
{
|
188
196
|
return SDL_WaitEvent((SDL_Event*)ev);
|
189
197
|
}
|
190
198
|
#endif
|
199
|
+
|
200
|
+
#if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) || defined(HAVE_RB_THREAD_BLOCKING_REGION)
|
201
|
+
static void ubf_SDL_WaitEvent(void* unused)
|
202
|
+
{
|
203
|
+
SDL_Event ev;
|
204
|
+
ev.type = SDL_USEREVENT;
|
205
|
+
ev.user.code = 19002; /* Code for interrupt */
|
206
|
+
ev.user.data1 = ev.user.data2 = NULL;
|
207
|
+
|
208
|
+
SDL_PushEvent(&ev);
|
209
|
+
}
|
210
|
+
#endif
|
211
|
+
|
191
212
|
static VALUE Event_s_wait(VALUE class)
|
192
213
|
{
|
193
214
|
SDL_Event event;
|
194
|
-
rb_secure(4);
|
195
|
-
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
196
215
|
/* Ruby 1.9 and above: Release the global VM lock while calling
|
197
|
-
* SDL_WaitEvent, allowing other Ruby threads to execute.
|
198
|
-
|
199
|
-
#else
|
200
|
-
/* Ruby 1.8 and below: Call SDL_WaitEvent directly.
|
216
|
+
* SDL_WaitEvent, allowing other Ruby threads to execute.
|
217
|
+
* Ruby 1.8 and below: Call SDL_WaitEvent directly.
|
201
218
|
* No other threads can execute during this call. */
|
219
|
+
#if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
|
220
|
+
if ((intptr_t)rb_thread_call_without_gvl(wait_event, &event, ubf_SDL_WaitEvent, NULL) == 1)
|
221
|
+
#elif defined(HAVE_RB_THREAD_BLOCKING_REGION)
|
222
|
+
if( rb_thread_blocking_region(wait_event, &event, ubf_SDL_WaitEvent, NULL) == 1)
|
223
|
+
#else
|
202
224
|
if( SDL_WaitEvent(&event) == 1)
|
203
225
|
#endif
|
204
226
|
return event_creators[event.type](&event);
|
@@ -221,7 +243,6 @@ static VALUE Event_s_push(VALUE class, VALUE event)
|
|
221
243
|
{
|
222
244
|
SDL_Event e;
|
223
245
|
VALUE eventClass;
|
224
|
-
rb_secure(4);
|
225
246
|
eventClass = CLASS_OF(event);
|
226
247
|
if(eventClass == cActiveEvent){
|
227
248
|
e.type = SDL_ACTIVEEVENT;
|
@@ -306,13 +327,11 @@ static VALUE Event_s_getAppState(VALUE class)
|
|
306
327
|
|
307
328
|
static VALUE Event_s_enableUNICODE(VALUE class)
|
308
329
|
{
|
309
|
-
rb_secure(4);
|
310
330
|
SDL_EnableUNICODE(1);
|
311
331
|
return Qnil;
|
312
332
|
}
|
313
333
|
static VALUE Event_s_disableUNICODE(VALUE class)
|
314
334
|
{
|
315
|
-
rb_secure(4);
|
316
335
|
SDL_EnableUNICODE(0);
|
317
336
|
return Qnil;
|
318
337
|
}
|
data/rubysdl_event_key.c
CHANGED
@@ -307,7 +307,6 @@ static void define_const(void)
|
|
307
307
|
|
308
308
|
static VALUE Key_s_scan(VALUE mod)
|
309
309
|
{
|
310
|
-
rb_secure(4);
|
311
310
|
key_state=SDL_GetKeyState(NULL);
|
312
311
|
mod_state=SDL_GetModState();
|
313
312
|
return Qnil;
|
@@ -316,7 +315,6 @@ static VALUE Key_s_scan(VALUE mod)
|
|
316
315
|
static VALUE Key_s_press_p(VALUE mod, VALUE keysym)
|
317
316
|
{
|
318
317
|
int sym = NUM2INT(keysym);
|
319
|
-
rb_secure(4);
|
320
318
|
if(sym < SDLK_FIRST || SDLK_LAST < sym )
|
321
319
|
rb_raise(eSDLError, "%d is out of key", sym);
|
322
320
|
if(key_state == NULL)
|
@@ -327,13 +325,11 @@ static VALUE Key_s_press_p(VALUE mod, VALUE keysym)
|
|
327
325
|
|
328
326
|
static VALUE Key_s_modState(VALUE mod)
|
329
327
|
{
|
330
|
-
rb_secure(4);
|
331
328
|
return UINT2NUM(mod_state);
|
332
329
|
}
|
333
330
|
|
334
331
|
static VALUE Key_s_enableKeyRepeat(VALUE mod, VALUE delay, VALUE interval)
|
335
332
|
{
|
336
|
-
rb_secure(4);
|
337
333
|
if( SDL_EnableKeyRepeat(NUM2INT(delay), NUM2INT(interval))==-1 ){
|
338
334
|
rb_raise(eSDLError, "enable key repeat fail: %s", SDL_GetError());
|
339
335
|
}
|
@@ -342,7 +338,6 @@ static VALUE Key_s_enableKeyRepeat(VALUE mod, VALUE delay, VALUE interval)
|
|
342
338
|
|
343
339
|
static VALUE Key_s_disableKeyRepeat(VALUE mod)
|
344
340
|
{
|
345
|
-
rb_secure(4);
|
346
341
|
if( SDL_EnableKeyRepeat(0, 0)==-1 ){
|
347
342
|
rb_raise(eSDLError, "disable key repeat fail: %s", SDL_GetError());
|
348
343
|
}
|