rubysdl-mswin32-1.9 2.1.0.1 → 2.1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.en +13 -0
- data/NEWS.ja +91 -78
- data/README.en +13 -12
- data/README.en.win32 +5 -10
- data/README.ja +139 -140
- data/README.ja.win32 +6 -6
- data/dll/SDL.dll +0 -0
- data/dll/SDL_image.dll +0 -0
- data/dll/SDL_mixer.dll +0 -0
- data/dll/jpeg.dll +0 -0
- data/dll/libogg-0.dll +0 -0
- data/dll/libpng12-0.dll +0 -0
- data/dll/libtiff-3.dll +0 -0
- data/dll/libvorbis-0.dll +0 -0
- data/dll/libvorbisfile-3.dll +0 -0
- data/dll/smpeg.dll +0 -0
- data/dll/zlib1.dll +0 -0
- data/ext/opengl.so +0 -0
- data/ext/sdl_ext.so +0 -0
- data/lib/rubysdl_compatible_ver1.rb +5 -3
- data/lib/sdl.rb +2 -2
- data/rubysdl_ref.en.html +5868 -0
- data/rubysdl_ref.html +6181 -5888
- data/sample/load_from_io.rb +2 -3
- data/sample/testgl.rb +96 -93
- metadata +5 -24
- data/doc/cdrom.rd +0 -305
- data/doc/collision.rd +0 -121
- data/doc/event.rd +0 -1090
- data/doc/font.rd +0 -625
- data/doc/general.rd +0 -60
- data/doc/init.rd +0 -142
- data/doc/joystick.rd +0 -301
- data/doc/mixer.rd +0 -584
- data/doc/mpeg.rd +0 -420
- data/doc/opengl.rd +0 -144
- data/doc/rsd.rb +0 -158
- data/doc/sdlskk.rd +0 -404
- data/doc/time.rd +0 -34
- data/doc/video.rd +0 -2269
- data/doc/wm.rd +0 -78
- data/ext/sdl.so +0 -0
- data/rubysdl_doc_old.en.rd +0 -2181
- data/rubysdl_doc_old.rd +0 -2402
- data/rubysdl_ref.rd +0 -6577
- data/sample/caption.rb +0 -21
- data/sample/rubysdl.rb +0 -33
data/doc/wm.rd
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
= Window Management
|
2
|
-
* ((<Window Management����>))
|
3
|
-
* ((<Window Management��Ϣ��å�>))
|
4
|
-
* ((<SDL::WM.caption>)) -- ������ɥ��Υ����ȥ�ȥ�������̾��������ޤ���
|
5
|
-
* ((<SDL::WM.set_caption>)) -- ������ɥ��Υ����ȥ�ȥ�������̾�åȤ��ޤ���
|
6
|
-
* ((<SDL::WM.icon=>)) -- ɽ��������ɥ��˥�������åȤ��ޤ���
|
7
|
-
* ((<SDL::WM.iconify>)) -- ������ɥ�������/�Ǿ������ޤ���
|
8
|
-
* ((<SDL::WM.grab_input>)) -- �ޥ����ȥ����ܡ������Ϥ�Ĥ����Υ���ʤ��褦�ˤ��ޤ���
|
9
|
-
|
10
|
-
== Window Management����
|
11
|
-
SDL �ϥ�����ɥ������ε�ǽ�ΰ��������Ƥ��ꡢ
|
12
|
-
���ץꥱ��������ȤΥ����ȥ���ѹ������ꡢ
|
13
|
-
�ե륹�����⡼�ɤ����ݡ��Ȥ���Ƥ����
|
14
|
-
������ɥ��⡼�ɤȥե륹�����⡼�ɤȤ��ڤ괹����
|
15
|
-
���Ȥ��Ǥ��ޤ���
|
16
|
-
|
17
|
-
== Window Management��Ϣ��å�
|
18
|
-
|
19
|
-
--- SDL::WM.caption
|
20
|
-
|
21
|
-
������ɥ��Υ����ȥ�ȥ�������̾��ʸ����2�Ĥ�������֤��ޤ���
|
22
|
-
|
23
|
-
* See Also
|
24
|
-
|
25
|
-
((<SDL::WM.set_caption>))
|
26
|
-
|
27
|
-
--- SDL::WM.set_caption(title, icon)
|
28
|
-
--- SDL::WM.setCaption(title, icon)
|
29
|
-
|
30
|
-
ɽ��������ɥ��Υ����ȥ�С��ȥ�������̾�åȤ��ޤ���
|
31
|
-
|
32
|
-
* See Also
|
33
|
-
|
34
|
-
((<SDL::WM.caption>)), ((<SDL::WM.icon=>))
|
35
|
-
|
36
|
-
--- SDL::WM.icon=(icon_image)
|
37
|
-
|
38
|
-
ɽ��������ɥ��˥�������åȤ��ޤ���
|
39
|
-
Win32 �Υ�������� 32��32 �Ǥʤ���Ф����ޤ���
|
40
|
-
|
41
|
-
���Υ⥸�塼��ؿ��ϡ�((<SDL.set_video_mode>)) ��
|
42
|
-
���ƸƤ����˸ƤФ�ʤ���Ф����ޤ���
|
43
|
-
((|icon|))�Ȥ��Ƥ� ((<SDL::Surface>)) �Υ�����Ϳ���ޤ���
|
44
|
-
|
45
|
-
|
46
|
-
EXAMPLE
|
47
|
-
SDL::WM.icon = SDL::Surface.load_bmp("icon.bmp")
|
48
|
-
|
49
|
-
* See Also
|
50
|
-
|
51
|
-
((<SDL.set_video_mode>)), ((<SDL::WM.caption>))
|
52
|
-
|
53
|
-
--- SDL::WM.iconify
|
54
|
-
|
55
|
-
������ɥ����������Ķ��ǥ��ץꥱ������¹Ԥ���Ƥ����硢
|
56
|
-
Ruby/SDL �ϥ��ץꥱ������������/�Ǿ������뤳�Ȥ��ߤޤ���
|
57
|
-
�⤷��������С����ץꥱ�������� ((<SDL::Event::APPACTIVE>)) �ʤä�
|
58
|
-
���٥�Ȥ�������Ǥ��礦��
|
59
|
-
|
60
|
-
���Ԥ����Ȥ��ˤ��㳰((<SDL::Error>))��ȯ�������ޤ���
|
61
|
-
|
62
|
-
--- SDL::WM.grab_input(mode)
|
63
|
-
--- SDL::WM.grabInput(mode)
|
64
|
-
|
65
|
-
�Ĥ���(Grabbing)�Ȥϡ��ޥ��������ץꥱ���������ɥ����Ĥ������졢
|
66
|
-
�ۤ����ƤΥ����ܡ������Ϥ�ľ�ܥ��ץꥱ��������ž�����졢
|
67
|
-
������ɥ��ޥ͡�����ˤ��ᤵ��ʤ����Ȥ�ɽ���ޤ���
|
68
|
-
|
69
|
-
((|mode|)) �Ȥ��ưʲ��������Ϳ���뤳�Ȥ��Ǥ��ޤ���
|
70
|
-
* SDL::WM::GRAB_QUERY
|
71
|
-
* SDL::WM::GRAB_OFF
|
72
|
-
* SDL::WM::GRAB_ON
|
73
|
-
|
74
|
-
((|mode|)) �� SDL::WM::GRAB_QUERY �ΤȤ��ϡ�
|
75
|
-
grab �⡼�ɤ��ѹ�����ʤ��Ǹ��ߤ� grab �⡼�ɤ��֤���ޤ���
|
76
|
-
|
77
|
-
���ߤΡ����뤤�Ͽ������⡼�ɤ��֤��ޤ���
|
78
|
-
|
data/ext/sdl.so
DELETED
Binary file
|
data/rubysdl_doc_old.en.rd
DELETED
@@ -1,2181 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
|
3
|
-
= SDL
|
4
|
-
|
5
|
-
Interface of this lib is very close to SDL.
|
6
|
-
So you also had better refer to SDL document.
|
7
|
-
|
8
|
-
nAll classes/modules in Ruby/SDL are in "module SDL".
|
9
|
-
In this module number starts 0,not 1.
|
10
|
-
|
11
|
-
== Class/Module
|
12
|
-
* ((<Error handling>))
|
13
|
-
* ((<SDL::Error>))
|
14
|
-
* ((<initialize>))
|
15
|
-
* ((<video>))
|
16
|
-
* ((<SDL::Surface>))
|
17
|
-
* ((<SDL::Screen>))
|
18
|
-
* ((<SDL::CollisionMap>))
|
19
|
-
* ((<SDL::PixelFormat>))
|
20
|
-
* ((<Event handling>))
|
21
|
-
* ((<SDL::Event>))
|
22
|
-
* ((<SDL::Event2>))
|
23
|
-
* ((<SDL::Key>)) (module)
|
24
|
-
* ((<SDL::Mouse>)) (module)
|
25
|
-
* ((<audio>))
|
26
|
-
* ((<SDL::Mixer>)) (module)
|
27
|
-
* ((<SDL::Mixer::Wave>))
|
28
|
-
* ((<SDL::Mixer::Music>))
|
29
|
-
* ((<Window Manager>))
|
30
|
-
* ((<SDL::WM>)) (module)
|
31
|
-
* ((<CDROM>))
|
32
|
-
* ((<SDL::CD>))
|
33
|
-
* ((<Joystick handling>))
|
34
|
-
* ((<SDL::Joystick>))
|
35
|
-
* ((<Font handling>))
|
36
|
-
* ((<SDL::BMFont>))
|
37
|
-
* ((<SDL::Kanji>))
|
38
|
-
* ((<SDL::TTF>))
|
39
|
-
* ((<MPEG stream>))
|
40
|
-
* ((<SDL::MPEG>))
|
41
|
-
* ((<Time>))
|
42
|
-
* ((<Japanese input method with SDLSKK>))
|
43
|
-
* ((<SDL::SKK::Context>))
|
44
|
-
* ((<SDL::SKK::Dictionary>))
|
45
|
-
* ((<SDL::SKK::RomKanaRuleTable>))
|
46
|
-
* ((<SDL::SKK::Keybind>))
|
47
|
-
* ((<3D drawing with OpenGL>))
|
48
|
-
* ((<Others>))
|
49
|
-
|
50
|
-
== Error handling
|
51
|
-
=== SDL::Error
|
52
|
-
|
53
|
-
SDL::Error is exception class. Almost all of errors in Ruby/SDL are
|
54
|
-
reported by this class.
|
55
|
-
|
56
|
-
==== super class
|
57
|
-
|
58
|
-
StandardError
|
59
|
-
|
60
|
-
== initialize
|
61
|
-
|
62
|
-
=== module functions in module SDL
|
63
|
-
|
64
|
-
--- SDL.init(flag)
|
65
|
-
Initialize SDL. This should be called before all other SDL functions. The
|
66
|
-
flags parameter specifies what part(s) of SDL to initialize.
|
67
|
-
SDL::INIT_AUDIO initialize audio output functions
|
68
|
-
SDL::INIT_VIDEO initialize video output functions and input functions
|
69
|
-
SDL::INIT_CDROM initialize CD playback fucntions
|
70
|
-
SDL::INIT_JOYSTICK initialize joystick input functions
|
71
|
-
You should call this method before calling other Ruby/SDL methods.
|
72
|
-
|
73
|
-
--- SDL.quit
|
74
|
-
Quit SDL system. You needn't call this function normally because
|
75
|
-
this library call this function automatically when the process
|
76
|
-
stops.
|
77
|
-
|
78
|
-
|
79
|
-
--- SDL.initedSystem(flag)
|
80
|
-
--- SDL.inited_system(flag)
|
81
|
-
Not documented yet
|
82
|
-
|
83
|
-
--- SDL.getenv
|
84
|
-
--- SDL.putenv(envstr)
|
85
|
-
Change or add an environment variable on Win32. On other platforms
|
86
|
-
this method is equal to ENV.
|
87
|
-
|
88
|
-
((|envstr|)) should be of the form "name=value".
|
89
|
-
|
90
|
-
Returns nil, raise exception `SDL::Error' when it fails.
|
91
|
-
|
92
|
-
You should use this method to set SDL_WINDOWID or SDL_VIDEODRIVER.
|
93
|
-
== video
|
94
|
-
|
95
|
-
some functions need SGE or SDL_image
|
96
|
-
|
97
|
-
=== functions in module SDL
|
98
|
-
|
99
|
-
--- SDL.getVideoSurface
|
100
|
-
--- SDL.get_video_surface
|
101
|
-
Not documented yet
|
102
|
-
|
103
|
-
--- SDL.setVideoMode(w,h,bpp,flags)
|
104
|
-
--- SDL.set_video_mode(w,h,bpp,flags)
|
105
|
-
Set up a video mode with the specified width, height and bits-per-pixel.
|
106
|
-
If bpp is 0, it is treated as the current display bits per pixel.
|
107
|
-
Return the instanse of ((<SDL::Screen>)), if succeeded.
|
108
|
-
Raise SDL::Error, if failed.
|
109
|
-
* SDL::SWSURFACE
|
110
|
-
|
111
|
-
Create the video surface in system memory.
|
112
|
-
|
113
|
-
* SDL::HWSURFACE
|
114
|
-
|
115
|
-
Create the video surface in video memory.
|
116
|
-
|
117
|
-
* SDL::FULLSCREEN
|
118
|
-
|
119
|
-
SDL will attempt to use a fullscreen mode.
|
120
|
-
|
121
|
-
* SDL::SDL_DOUBLEBUF
|
122
|
-
|
123
|
-
Enable double buffering.
|
124
|
-
Calling ((<SDL::Screen#flip>)) will flip the buffers and update
|
125
|
-
the screen.
|
126
|
-
|
127
|
-
--- SDL.checkVideoMode(w,h,bpp,flags)
|
128
|
-
--- SDL.check_video_mode(w,h,bpp,flags)
|
129
|
-
Check to see if a particular video mode is supported.
|
130
|
-
Returns 0 if the requested mode is not supported under any
|
131
|
-
bit depth, or returns the bits-per-pixel of the closest available mode
|
132
|
-
with the given width, height and requested surface flags (see
|
133
|
-
SDL_SetVideoMode).
|
134
|
-
|
135
|
-
The bits-per-pixel value returned is only a suggested mode. You can
|
136
|
-
usually request and bpp you want when setting the video mode and SDL will
|
137
|
-
emulate that color depth with a shadow video surface.
|
138
|
-
|
139
|
-
The arguments to checkVideoMode are the same ones you would pass to
|
140
|
-
((<SDL.setVideoMode>)).
|
141
|
-
|
142
|
-
--- SDL.listModes(flags)
|
143
|
-
--- SDL.list_modes(flags)
|
144
|
-
Returns availanel screen demensions for the given flags.
|
145
|
-
Returns nil if there are no available dimensions.
|
146
|
-
Returns true if any dimension is okay.
|
147
|
-
Otherwise returns list of available dimensions in array.
|
148
|
-
|
149
|
-
--- SDL.videoDriverName
|
150
|
-
--- SDL.video_driver_name
|
151
|
-
Returns the name of initialized video driver like "x11" or "windib".
|
152
|
-
Raise exeption if video have not been initialized.
|
153
|
-
|
154
|
-
--- SDL.setGamma(redgamma,greengamma,bluegamma)
|
155
|
-
--- SDL.set_gamma(redgamma,greengamma,bluegamma)
|
156
|
-
Sets the "gamma function" for the display of each color component.
|
157
|
-
Gamma controls the brightness/contrast of colors displayed on
|
158
|
-
the screen. A gamma value of 1.0 is identity
|
159
|
-
(i.e., no adjustment is made).
|
160
|
-
|
161
|
-
--- SDL.getGammaRamp
|
162
|
-
--- SDL.get_gamma_ramp
|
163
|
-
Returns the gamma translation lookup tables currently used
|
164
|
-
by the display. Return value is array that has r, g, b table.
|
165
|
-
Each table is array that has 256 integer.
|
166
|
-
|
167
|
-
--- SDL.setGammaRamp(table)
|
168
|
-
--- SDL.set_gamma_ramp(table)
|
169
|
-
Sets the gamma lookup tables for the display for each color component.
|
170
|
-
table should be an array like what you can get
|
171
|
-
with ((<SDL.getGammaRamp>)).
|
172
|
-
|
173
|
-
--- SDL.autoLock
|
174
|
-
--- SDL.auto_lock
|
175
|
-
--- SDL.autoLock?
|
176
|
-
--- SDL.auto_lock?
|
177
|
-
Needs SGE
|
178
|
-
|
179
|
-
Returns whether Ruby/SDL locks surface automatically when
|
180
|
-
need.Default is true.
|
181
|
-
|
182
|
-
Please see ((<SDL::Surface#lock>)) to know more.
|
183
|
-
|
184
|
-
--- SDL.autoLock=(autolocking)
|
185
|
-
--- SDL.auto_lock=(autolocking)
|
186
|
-
--- SDL.autoLockON
|
187
|
-
--- SDL.auto_lock_on
|
188
|
-
--- SDL.autoLockOFF
|
189
|
-
--- SDL.auto_lock_off
|
190
|
-
Needs SGE
|
191
|
-
|
192
|
-
Set whether Ruby/SDL locks surface automatically when
|
193
|
-
needed.
|
194
|
-
|
195
|
-
--- SDL.videoInfo
|
196
|
-
--- SDL.video_info
|
197
|
-
Return video information in the object of VideoInfo .
|
198
|
-
The contents are following.
|
199
|
-
Values represent boolean value are true/false .
|
200
|
-
Please read SDL document to know about this information.
|
201
|
-
SDL::VideoInfo#hw_available
|
202
|
-
SDL::VideoInfo#wm_available
|
203
|
-
SDL::VideoInfo#blit_hw
|
204
|
-
SDL::VideoInfo#blit_hw_CC
|
205
|
-
SDL::VideoInfo#blit_hw_A
|
206
|
-
SDL::VideoInfo#blit_sw
|
207
|
-
SDL::VideoInfo#blit_sw_CC
|
208
|
-
SDL::VideoInfo#blit_sw_A
|
209
|
-
SDL::VideoInfo#blit_fill
|
210
|
-
SDL::VideoInfo#video_mem
|
211
|
-
SDL::VideoInfo#bpp
|
212
|
-
|
213
|
-
--- SDL.blitSurface(src,srcX,srcY,srcW,srcH,dst,dstX,dstY)
|
214
|
-
--- SDL.blit_surface(src,srcX,srcY,srcW,srcH,dst,dstX,dstY)
|
215
|
-
This performs a fast blit from the source surface to the destination
|
216
|
-
surface.
|
217
|
-
|
218
|
-
If srcX=srcY=srcW=srcH=0,the entire surface is copied.
|
219
|
-
|
220
|
-
The blit function should not be called on a locked surface.
|
221
|
-
|
222
|
-
--- SDL.blitSurface2(src,srcRect,dst,dstRect)
|
223
|
-
--- SDL.blit_surface2(src,src_rect,dst,dst_rect)
|
224
|
-
You use this function like:
|
225
|
-
blitSurface2(src,[0,32,32,32],dst,[100,200])
|
226
|
-
or
|
227
|
-
Rect = Struct.new( 'Rect', :x, :y, :w, :h )
|
228
|
-
|
229
|
-
rect1 = Rect.new( 16, 0, 16, 16 )
|
230
|
-
rect2 = Rect.new( 120, 0, 0, 0 )
|
231
|
-
blitSurface2( src, rect1, dst, rect2 )
|
232
|
-
|
233
|
-
--- SDL.rotateXYScaled(src,dst,x,y,angle,xscale,yscale)
|
234
|
-
--- SDL.rotateXY_scaled(src,dst,x,y,angle,xscale,yscale)
|
235
|
-
Needs SGE
|
236
|
-
|
237
|
-
Note that this function is different from SGE sge_rotate_xyscaled API
|
238
|
-
in that src and dst are changing.
|
239
|
-
Following two functions are same.
|
240
|
-
This is equal to blitSurface.
|
241
|
-
|
242
|
-
And note that this function ignores colorkey.
|
243
|
-
|
244
|
-
This method is obsolete. Please use ((<SDL.transform>)) or
|
245
|
-
((<SDL.transformBlit>))
|
246
|
-
|
247
|
-
--- SDL.rotateScaled(src,dst,x,y,angle,scale)
|
248
|
-
--- SDL.rotate_scaled(src,dst,x,y,angle,scale)
|
249
|
-
Same as above, but with xscale=yscale.
|
250
|
-
|
251
|
-
--- SDL.rotate(src,dst,x,y,angle)
|
252
|
-
Same as above, but with xscale=yscale=1.0.
|
253
|
-
|
254
|
-
--- SDL.rotateScaledBlit(src,dst,x,y,angle,scale)
|
255
|
-
--- SDL.rotate_scaled_blit(src,dst,x,y,angle,scale)
|
256
|
-
Needs SGE
|
257
|
-
|
258
|
-
Same as rotateScaled,but respect colorkey.
|
259
|
-
|
260
|
-
--- SDL.rotateBlit(src,dst,x,y,angle)
|
261
|
-
--- SDL.rotate_blit(src,dst,x,y,angle)
|
262
|
-
Same as rotateScaledBlit,but with scale=1.0;
|
263
|
-
|
264
|
-
--- SDL.transform(src,dst,angle,xscale,yscale,px,py,qx,qy,flags)
|
265
|
-
Need SGE
|
266
|
-
|
267
|
-
Draw src surface to dst surface with scaling and rotation.
|
268
|
-
Ignore colorkey.
|
269
|
-
|
270
|
-
*src - The surface to be rotated and scaled
|
271
|
-
*src - The surface to be rotated and scaled
|
272
|
-
*angle - The rotation angle in degrees.
|
273
|
-
*xscale yscale - The x and y scaling factor. Can be negative
|
274
|
-
(mirroring). 1.0 is 1:1 scale.
|
275
|
-
*px / py - The pivot point to rotate around in the src surface.
|
276
|
-
*qx / qy - The destination point on dst surface.
|
277
|
-
*flags
|
278
|
-
*0 - Default.
|
279
|
-
*SGE_TAA - Use the interpolating renderer. Much slower but
|
280
|
-
can look better.
|
281
|
-
*SGE_TSAFE - Don't asume that the src and dst surfaces has the
|
282
|
-
same pixel format. This is the default when the two surfaces
|
283
|
-
don't have the same BPP.
|
284
|
-
This is slower but will render wierd pixel formats right.
|
285
|
-
*SGE_TTMAP - Use texture mapping. This is a bit faster
|
286
|
-
but the result isn't
|
287
|
-
as nice as in the normal mode. This mode will also ignore the px/py
|
288
|
-
coordinates and the other flags.
|
289
|
-
|
290
|
-
--- SDL.transformBlit(src,dst,angle,xscale,yscale,px,py,qx,qy,flags)
|
291
|
-
--- SDL.transform_blit(src,dst,angle,xscale,yscale,px,py,qx,qy,flags)
|
292
|
-
Need SGE
|
293
|
-
|
294
|
-
Blit src surface to dst surface with scaling and rotation.
|
295
|
-
Same as ((<SDL.transform>)) , but respect colorkey.
|
296
|
-
|
297
|
-
=== SDL::Surface
|
298
|
-
|
299
|
-
This class have image.
|
300
|
-
|
301
|
-
==== super class
|
302
|
-
|
303
|
-
Object
|
304
|
-
|
305
|
-
==== class method
|
306
|
-
|
307
|
-
--- SDL::Surface.new(flag,w,h,format)
|
308
|
-
--- SDL::Surface.new(flags,w,h,depth,Rmask,Gmask,Bmask,Amask)
|
309
|
-
Create an empty surface.
|
310
|
-
You must call this method after ((<SDL.setVideoMode>))
|
311
|
-
|
312
|
-
format must be the instance of ((<SDL::Surface>)), and create the
|
313
|
-
surface that has same bpp as specified surface.
|
314
|
-
|
315
|
-
The flags specifies the type of surface that should be
|
316
|
-
created, it is an OR'd combination of the following possible values.
|
317
|
-
|
318
|
-
* SDL::SWSURFACE
|
319
|
-
|
320
|
-
SDL will create the surface in system memory.
|
321
|
-
|
322
|
-
* SDL::HWSURFACE
|
323
|
-
|
324
|
-
SDL will attempt to create the surface in video memory.
|
325
|
-
|
326
|
-
* SDL::SRCCOLORKEY
|
327
|
-
|
328
|
-
With this flag SDL will attempt to find the best
|
329
|
-
location for this surface, either in system memory or
|
330
|
-
video memory, to obtain hardware colorkey blitting
|
331
|
-
support.
|
332
|
-
|
333
|
-
* SDL::SRCALPHA
|
334
|
-
|
335
|
-
With this flag SDL will attempt to find the best
|
336
|
-
location for this surface, either in system memory or
|
337
|
-
video memory, to obtain hardware alpha support.
|
338
|
-
|
339
|
-
--- SDL::Surface.new_from(pixels,w,h,depth,pitch,Rmask,Gmask,Bmask,Amask)
|
340
|
-
Create a surface from pixel data.
|
341
|
-
((|pixels|)) must be String. ((|pitch|)) is the length of
|
342
|
-
each scanline in bytes.
|
343
|
-
|
344
|
-
--- SDL::Surface.loadBMP(filename)
|
345
|
-
--- SDL::Surface.load_bmp(filename)
|
346
|
-
Loads a image from a named Windows BMP file and return
|
347
|
-
the instance of ((<SDL::Screen>)).
|
348
|
-
|
349
|
-
Raise SDL::Error if you have an error,for example file didn't exist.
|
350
|
-
|
351
|
-
--- SDL::Surface.load(filename)
|
352
|
-
Needs SDL_image
|
353
|
-
Loads a image from a named Windows BMP file and return
|
354
|
-
the instance of ((<SDL::Screen>)).
|
355
|
-
|
356
|
-
Available formats are BMP,PPX,XPM,PCX,GIF,JPEG,PNG,TGA.
|
357
|
-
|
358
|
-
==== method
|
359
|
-
|
360
|
-
--- SDL::Surface#saveBMP(filename)
|
361
|
-
--- SDL::Surface#save_bmp(filename)
|
362
|
-
Saves the surface as a Windows BMP file named file.
|
363
|
-
|
364
|
-
--- SDL::Surface#displayFormat
|
365
|
-
--- SDL::Surface#display_format
|
366
|
-
This method copies self to a new surface of the pixel
|
367
|
-
format and colors of the video framebuffer, suitable for fast blitting
|
368
|
-
onto the display surface.
|
369
|
-
|
370
|
-
If you want to take advantage of hardware colorkey or alpha blit
|
371
|
-
acceleration, you should set the colorkey and alpha value before calling
|
372
|
-
this method.
|
373
|
-
|
374
|
-
--- SDL::Surface#displayFormatAlpha
|
375
|
-
--- SDL::Surface#display_format_alpha
|
376
|
-
Same as ((<SDL::Surface#displayFormat>)), except respecting
|
377
|
-
alpha value per pixel.
|
378
|
-
|
379
|
-
--- SDL::Surface#setColorKey(flag,key)
|
380
|
-
--- SDL::Surface#set_color_key(flag,key)
|
381
|
-
Sets the color key (transparent pixel) in a blittable surface and enables
|
382
|
-
or disables RLE blit acceleration.
|
383
|
-
If flag is SDL::SRCCOLORKEY then key is the transparent pixel
|
384
|
-
value in the source image of a blit.
|
385
|
-
If flag is OR'd with SDL::RLEACCEL then the surface will be draw
|
386
|
-
using RLE acceleration when drawn with blitting.
|
387
|
-
|
388
|
-
--- SDL::Surface#fillRect(x,y,w,h)
|
389
|
-
--- SDL::Surface#fill_rect(x,y,w,h)
|
390
|
-
This function performs a fast fill of the given rectangle with color.
|
391
|
-
|
392
|
-
--- SDL::Surface#setClipRect(x,y,w,h)
|
393
|
-
--- SDL::Surface#set_clip_rect(x,y,w,h)
|
394
|
-
Sets the clipping rectangle for a surface. When this surface is the
|
395
|
-
destination of a blit, only the area within the clip rectangle will
|
396
|
-
be drawn into.
|
397
|
-
|
398
|
-
The rectangle pointed to by rect will be clipped to the edges of the
|
399
|
-
surface so that the clip rectangle for a surface can never fall
|
400
|
-
outside the edges of the surface.
|
401
|
-
|
402
|
-
--- SDL::Surface#getClipRect
|
403
|
-
--- SDL::Surface#get_clip_rect
|
404
|
-
Returns the clipping rectangle for this surface.
|
405
|
-
Return value is an array including x, y, r, w value.
|
406
|
-
|
407
|
-
--- SDL::Surface#setAlpha(flag,alpha)
|
408
|
-
--- SDL::Surface#set_alpha(flag,alpha)
|
409
|
-
SDL_SetAlpha is used for setting the per-surface alpha and/or enabling
|
410
|
-
and disabling per-pixel alpha blending.
|
411
|
-
|
412
|
-
flags is used to specify whether alpha blending should be used
|
413
|
-
(SDL::SRCALPHA) and whether the surface should use RLE acceleration
|
414
|
-
for blitting (SDL::RLEACCEL). flags can be an OR'd combination of these
|
415
|
-
two options, one of these options or 0. If SDL_SRCALPHA is not passed
|
416
|
-
as a flag then all alpha information is ignored when blitting
|
417
|
-
the surface. The alpha parameter is the per-surface alpha value,
|
418
|
-
a surface need not have an alpha channel to use
|
419
|
-
per-surface alpha and blitting can still be accelerated with
|
420
|
-
SDL_RLEACCEL. Setting the per-surface alpha value to 0 disables
|
421
|
-
per-surface alpha blending.
|
422
|
-
|
423
|
-
--- SDL::Surface#h
|
424
|
-
Return height.
|
425
|
-
|
426
|
-
--- SDL::Surface#w
|
427
|
-
Return width.
|
428
|
-
|
429
|
-
--- SDL::Surface#format
|
430
|
-
Return pixel format.
|
431
|
-
See ((<SDL::PixelFormat>)).
|
432
|
-
|
433
|
-
--- SDL::Surface#put(image,x,y)
|
434
|
-
Draw image on (x,y) in self.
|
435
|
-
This method are implemented using blitSurface.
|
436
|
-
|
437
|
-
--- SDL::Surface#copyRect(x,y,w,h)
|
438
|
-
--- SDL::Surface#copy_rect(x,y,w,h)
|
439
|
-
Copy given rect and return copyed surface.
|
440
|
-
|
441
|
-
--- SDL::Surface#lock
|
442
|
-
This method sets up a surface for directly accessing the pixels.You call
|
443
|
-
this before calling ((<SDL::Surface#getPixel>)) ,
|
444
|
-
((<SDL::Surface#drawLine>)) or some other mehtods of Surface.
|
445
|
-
|
446
|
-
Between calls to ((<SDL::Surface#lock>)) and ((<SDL::Surface#unlock>)),
|
447
|
-
you can use methods that 'need locking'.
|
448
|
-
Once you are done accessing the surface, you
|
449
|
-
should use ((<SDL::Surface#unlock>)) to release it.
|
450
|
-
|
451
|
-
Not all surfaces require locking. If ((<SDL::Surface#mustLock?>)) returns
|
452
|
-
false, then you can read and write to the surface at any time, and the
|
453
|
-
pixel format of the surface will not change.
|
454
|
-
|
455
|
-
No operating system or library calls should be made between lock/unlock
|
456
|
-
pairs, as critical system locks may be held during this time.
|
457
|
-
|
458
|
-
If ((<SDL.autoLock>)) returns true,you don't have to call this methods
|
459
|
-
because this library locks surface automatically.
|
460
|
-
|
461
|
-
--- SDL::Surface#unlock
|
462
|
-
Unlock the surface.
|
463
|
-
|
464
|
-
--- SDL::Surface#mustLock?
|
465
|
-
--- SDL::Surface#must_lock?
|
466
|
-
Returns true if you must lock surface for directly accessing the pixels,
|
467
|
-
otherwise returns false.
|
468
|
-
|
469
|
-
--- SDL::Surface#getPixel(x,y)
|
470
|
-
--- SDL::Surface#get_pixel(x,y)
|
471
|
-
--- SDL::Surface#[](x,y)
|
472
|
-
Needs SGE ,Needs lock
|
473
|
-
Gets the color of the specified pixel.
|
474
|
-
You can convert this color value to RGB with ((<SDL::Surface#getRGBA>)).
|
475
|
-
|
476
|
-
--- SDL::Surface#putPixel(x,y,color)
|
477
|
-
--- SDL::Surface#put_pixel(x,y,color)
|
478
|
-
--- SDL::Surface#[]=(x,y,color)
|
479
|
-
Needs SGE ,Needs lock
|
480
|
-
Changes the color of the pixel on (x, y).
|
481
|
-
You can specify color by [r, g, b], [r, g, b, a] array or integer
|
482
|
-
given by ((<SDL::Surface#mapRGBA>)).
|
483
|
-
|
484
|
-
--- SDL::Surface#drawLine(x1,y1,x2,y2,color)
|
485
|
-
--- SDL::Surface#draw_line(x1,y1,x2,y2,color)
|
486
|
-
Needs SGE ,Needs lock
|
487
|
-
Draws a line from (x1,y1) to (x2,y2).
|
488
|
-
|
489
|
-
--- SDL::Surface#drawRect(x,y,w,h,color)
|
490
|
-
--- SDL::Surface#draw_rect(x,y,w,h,color)
|
491
|
-
Needs SGE ,Needs lock
|
492
|
-
Draws a rectangle.
|
493
|
-
|
494
|
-
--- SDL::Surface#drawCircle(x,y,r,color)
|
495
|
-
--- SDL::Surface#draw_circle(x,y,r,color)
|
496
|
-
Needs SGE ,Needs lock
|
497
|
-
Draws a circle.
|
498
|
-
|
499
|
-
--- SDL::Surface#drawFilledCircle(x,y,r,color)
|
500
|
-
--- SDL::Surface#draw_filled_circle(x,y,r,color)
|
501
|
-
Needs SGE ,Needs lock
|
502
|
-
Draws a filled circle.
|
503
|
-
|
504
|
-
--- SDL::Surface#drawEllipse(x,y,rx,ry,color)
|
505
|
-
--- SDL::Surface#draw_ellipse(x,y,rx,ry,color)
|
506
|
-
Needs SGE, Needs lock
|
507
|
-
Draws an ellipse.
|
508
|
-
|
509
|
-
--- SDL::Surface#drawEllispe(x,y,rx,ry,color)
|
510
|
-
See drawEllipse. This method exists for compatability but should not
|
511
|
-
be used.
|
512
|
-
|
513
|
-
--- SDL::Surface#drawFilledEllipse(x,y,rx,ry,color)
|
514
|
-
--- SDL::Surface#draw_filled_ellipse(x,y,rx,ry,color)
|
515
|
-
Needs SGE, Needs lock
|
516
|
-
Draws a filled ellipse.
|
517
|
-
|
518
|
-
--- SDL::Surface#drawFilledEllispe(x,y,rx,ry,color)
|
519
|
-
See drawFilledEllipse. This method exists for compatability but
|
520
|
-
should not be used.
|
521
|
-
|
522
|
-
--- SDL::Surface#drawAALine(x1,y1,x2,y2,color)
|
523
|
-
--- SDL::Surface#draw_aa_line(x1,y1,x2,y2,color)
|
524
|
-
Needs SGE ,Needs lock
|
525
|
-
|
526
|
-
Draws an antialiased line from (x1,y1) to (x2,y2).
|
527
|
-
|
528
|
-
--- SDL::Surface#drawAACircle(x,y,r,color)
|
529
|
-
--- SDL::Surface#draw_aa_circle(x,y,r,color)
|
530
|
-
Needs SGE ,Needs lock
|
531
|
-
|
532
|
-
Draws an antialiased circle.
|
533
|
-
|
534
|
-
--- SDL::Surface#drawAAFilledCircle(x,y,r,color)
|
535
|
-
--- SDL::Surface#draw_aa_filled_circle(x,y,r,color)
|
536
|
-
Needs SGE ,Needs lock
|
537
|
-
|
538
|
-
Draws a filled antialiased circle.
|
539
|
-
|
540
|
-
--- SDL::Surface#drawAAEllipse(x,y,rx,ry,color)
|
541
|
-
--- SDL::Surface#draw_aa_ellipse(x,y,rx,ry,color)
|
542
|
-
Needs SGE ,Needs lock
|
543
|
-
|
544
|
-
Draws an antialiased ellipse.
|
545
|
-
|
546
|
-
--- SDL::Surface#drawLineAlpha(x1,y1,x2,y2,color,alpha)
|
547
|
-
--- SDL::Surface#draw_line_alpha(x1,y1,x2,y2,color,alpha)
|
548
|
-
Needs SGE ,Needs lock
|
549
|
-
|
550
|
-
Draws a line with alpha blending.
|
551
|
-
|
552
|
-
--- SDL::Surface#drawRectAlpha(x,y,w,h,color,alpha)
|
553
|
-
--- SDL::Surface#draw_rect_alpha(x,y,w,h,color,alpha)
|
554
|
-
Needs SGE ,Needs lock
|
555
|
-
|
556
|
-
Draws a rectangle with alpha blending.
|
557
|
-
|
558
|
-
--- SDL::Surface#drawFilledRectAlpha(x,y,w,h,color,alpha)
|
559
|
-
--- SDL::Surface#draw_filled_rect_alpha(x,y,w,h,color,alpha)
|
560
|
-
Needs SGE ,Needs lock
|
561
|
-
|
562
|
-
x
|
563
|
-
|
564
|
-
--- SDL::Surface#drawCircleAlpha(x,y,r,color,alpha)
|
565
|
-
--- SDL::Surface#draw_circle_alpha(x,y,r,color,alpha)
|
566
|
-
Needs SGE ,Needs lock
|
567
|
-
|
568
|
-
Draws a circle with alpha blending.
|
569
|
-
|
570
|
-
--- SDL::Surface#drawFilledCircleAlpha(x,y,r,color,alpha)
|
571
|
-
--- SDL::Surface#draw_filled_circle_alpha(x,y,r,color,alpha)
|
572
|
-
Needs SGE ,Needs lock
|
573
|
-
|
574
|
-
Draws a filled circle with alpha blending.
|
575
|
-
|
576
|
-
--- SDL::Surface#drawEllipseAlpha(x,y,rx,ry,color,alpha)
|
577
|
-
--- SDL::Surface#draw_ellipse_alpha(x,y,rx,ry,color,alpha)
|
578
|
-
Needs SGE ,Needs lock
|
579
|
-
|
580
|
-
Draws an ellipse with alpha blending.
|
581
|
-
|
582
|
-
--- SDL::Surface#drawFilledEllipseAlpha(x,y,rx,ry,color,alpha)
|
583
|
-
--- SDL::Surface#draw_filled_ellipse_alpha(x,y,rx,ry,color,alpha)
|
584
|
-
Needs SGE ,Needs lock
|
585
|
-
|
586
|
-
Draws a filled ellipse with alpha blending.
|
587
|
-
|
588
|
-
--- SDL::Surface#drawAALineAlpha(x1,y1,x2,y2,color,alpha)
|
589
|
-
--- SDL::Surface#draw_aa_line_alpha(x1,y1,x2,y2,color,alpha)
|
590
|
-
Needs SGE ,Needs lock
|
591
|
-
|
592
|
-
Draws an antialiased line with alpha blending.
|
593
|
-
|
594
|
-
--- SDL::Surface#drawAACircleAlpha(x,y,r,color,alpha)
|
595
|
-
--- SDL::Surface#draw_aa_circle_alpha(x,y,r,color,alpha)
|
596
|
-
Needs SGE ,Needs lock
|
597
|
-
|
598
|
-
Draws an antialiased circle with alpha blending.
|
599
|
-
|
600
|
-
--- SDL::Surface#drawAAEllipseAlpha(x,y,rx,ry,color,alpha)
|
601
|
-
--- SDL::Surface#draw_aa_ellipse_alpha(x,y,rx,ry,color,alpha)
|
602
|
-
Needs SGE ,Needs lock
|
603
|
-
|
604
|
-
Draws an antialiased ellipse with alpha blending.
|
605
|
-
|
606
|
-
--- SDL::Surface#drawBezier(x1,y1,x2,y2,x3,y3,x4,y4,level,color)
|
607
|
-
--- SDL::Surface#draw_bezier(x1,y1,x2,y2,x3,y3,x4,y4,level,color)
|
608
|
-
Needs SGE ,Needs lock
|
609
|
-
|
610
|
-
Draws a bezier curve from (x1,y1) to (x4,y4) with the control
|
611
|
-
points (x2,y2) and (x3,y3). level indicates how good precision
|
612
|
-
the function should use, 4-7 is normal.
|
613
|
-
|
614
|
-
--- SDL::Surface#drawAABezier(x1,y1,x2,y2,x3,y3,x4,y4,level,color)
|
615
|
-
--- SDL::Surface#draw_aa_bezier(x1,y1,x2,y2,x3,y3,x4,y4,level,color)
|
616
|
-
Needs SGE ,Needs lock
|
617
|
-
|
618
|
-
Draws a antialiased bezier curve from (x1,y1) to (x4,y4) with the control
|
619
|
-
points (x2,y2) and (x3,y3). level indicates how good precision
|
620
|
-
the function should use, 4-7 is normal.
|
621
|
-
|
622
|
-
--- SDL::Surface#drawBezierAlpha(x1,y1,x2,y2,x3,y3,x4,y4,level,color,alpha)
|
623
|
-
--- SDL::Surface#draw_bezier_alpha(x1,y1,x2,y2,x3,y3,x4,y4,level,color,alpha)
|
624
|
-
Needs SGE ,Needs lock
|
625
|
-
|
626
|
-
Draws an alpha bezier curve from (x1,y1) to (x4,y4) with the control
|
627
|
-
points (x2,y2) and (x3,y3). level indicates how good precision
|
628
|
-
the function should use, 4-7 is normal.
|
629
|
-
|
630
|
-
--- SDL::Surface#drawAABezierAlpha(x1,y1,x2,y2,x3,y3,x4,y4,level,color,alpha)
|
631
|
-
--- SDL::Surface#draw_aa_bezier_alpha(x1,y1,x2,y2,x3,y3,x4,y4,level,color,alpha)
|
632
|
-
Needs SGE ,Needs lock
|
633
|
-
|
634
|
-
Draws an antialiased alpha bezier curve from (x1,y1) to (x4,y4)
|
635
|
-
with the control
|
636
|
-
points (x2,y2) and (x3,y3). level indicates how good precision
|
637
|
-
the function should use, 4-7 is normal.
|
638
|
-
|
639
|
-
--- SDL::Surface#rotateScaledSurface(angle,scale,bgcolor)
|
640
|
-
--- SDL::Surface#rotate_scaled_surface(angle,scale,bgcolor)
|
641
|
-
Needs SGE
|
642
|
-
This function makes the instance of Surface with a rotated and scaled
|
643
|
-
copy of "self". "angle" is the rotation angle in degrees.
|
644
|
-
"scale" is the scaling value , 1.0 is the normal size.
|
645
|
-
|
646
|
-
This method is obsolete. Please use ((<SDL::Surface#transformSurface>)).
|
647
|
-
|
648
|
-
--- SDL::Surface#rotateSurface(angle,bgcolor)
|
649
|
-
--- SDL::Surface#rotate_surface(angle,bgcolor)
|
650
|
-
Same as above,but with scale=1.0 .
|
651
|
-
|
652
|
-
--- SDL::Surface#transformSurface(bgcolor,angle,xscale,yscale,flags)
|
653
|
-
--- SDL::Surface#transform_surface(bgcolor,angle,xscale,yscale,flags)
|
654
|
-
Creates a rotated and scaled image of src. See ((<SDL.transform>))
|
655
|
-
for more information.
|
656
|
-
|
657
|
-
* bgcolor - What background color should the new surface have.
|
658
|
-
|
659
|
-
--- SDL::Surface#mapRGB(r,g,b)
|
660
|
-
--- SDL::Surface#map_rgb(r,g,b)
|
661
|
-
Maps the RGB color value to the pixel format of specified surface
|
662
|
-
and returns the pixel value as a integer.
|
663
|
-
|
664
|
-
--- SDL::Surface#mapRGBA(r,g,b,a)
|
665
|
-
--- SDL::Surface#map_rgba(r,g,b,a)
|
666
|
-
Same as above,but includes alpha value.
|
667
|
-
|
668
|
-
--- SDL::Surface#getRGB(pixel)
|
669
|
-
--- SDL::Surface#get_rgb(pixel)
|
670
|
-
Get RGB component values from a pixel stored in the specified pixel
|
671
|
-
format.Returns r,g,b value in array as [r,g,b].
|
672
|
-
|
673
|
-
--- SDL::Surface#getRGBA(pixel)
|
674
|
-
--- SDL::Surface#get_rgba(pixel)
|
675
|
-
Same as above, but return value includes alplah value.
|
676
|
-
Returns r,g,b,a in arrary as [r,g,b,a].
|
677
|
-
|
678
|
-
--- SDL::Surface#bpp
|
679
|
-
Return bits per pixel on this surface.
|
680
|
-
|
681
|
-
--- SDL::Surface#colorkey
|
682
|
-
Returns colorkey on this surface.
|
683
|
-
|
684
|
-
--- SDL::Surface#alpha
|
685
|
-
Returns alpha on this surface.
|
686
|
-
|
687
|
-
--- SDL::Surface#flags
|
688
|
-
Returns flags on this surface.
|
689
|
-
|
690
|
-
--- SDL::Surface#Rmask
|
691
|
-
--- SDL::Surface#Gmask
|
692
|
-
--- SDL::Surface#Bmask
|
693
|
-
--- SDL::Surface#Amask
|
694
|
-
Returns [RGBA] mask on this surface.
|
695
|
-
|
696
|
-
--- SDL::Surface#pixels
|
697
|
-
Returns pixel data as String.
|
698
|
-
|
699
|
-
--- SDL::Surface#setPalette(flag,colors,firstcolor)
|
700
|
-
--- SDL::Surface#set_palette(flag,colors,firstcolor)
|
701
|
-
Sets a portion of the palette for the given 8-bit surface.
|
702
|
-
|
703
|
-
Palettized (8-bit) screen surfaces with the SDL_HWPALETTE flag have two
|
704
|
-
palettes, a logical palette that is used for mapping blits to/from
|
705
|
-
the surface and a physical palette (that determines how the
|
706
|
-
hardware will map the colors to the display).
|
707
|
-
|
708
|
-
This method can modify either the logical or physical
|
709
|
-
palette by specifing SDL::LOGPAL or SDL::PHYSPAL in the flags parameter.
|
710
|
-
|
711
|
-
If you want to modify the palette from Xth to th, you will give
|
712
|
-
following array as colors, and X as firstcolor.
|
713
|
-
[ [rX,gX,bX],[rX+1,gX+1,bX+1], ... ,[rY,gY,bY] ]
|
714
|
-
|
715
|
-
--- SDL::Surface#setColors(colors,firstcolor)
|
716
|
-
--- SDL::Surface#set_colors(colors,firstcolor)
|
717
|
-
Same as ((<SDL::Surface#setPalette>)), but flag is
|
718
|
-
SDL::LOGPAL|SDL::PHYSPAL.
|
719
|
-
|
720
|
-
--- SDL::Surface#getPalette
|
721
|
-
--- SDL::Surface#get_palette
|
722
|
-
Returns the palette of the specified surface. Return value is array
|
723
|
-
as following.
|
724
|
-
[ [r0,g0,b0],[r1,g1,b1], ... ,[r255,g255,b255] ]
|
725
|
-
Returns nil if the surface have no palette.
|
726
|
-
|
727
|
-
--- SDL::Surface#makeCollisionMap
|
728
|
-
Need SGE
|
729
|
-
|
730
|
-
Create a collision map. Call SetColorKey first. Every
|
731
|
-
non-transparent pixel in the surface is set to solid in the collision
|
732
|
-
map. Returns an instance of CollisionMap.
|
733
|
-
|
734
|
-
=== SDL::CollisionMap
|
735
|
-
|
736
|
-
Need SGE
|
737
|
-
|
738
|
-
This is a map of which pixels in a surface are solid and which are
|
739
|
-
transparent. Its methods can quickly determine whether or not two
|
740
|
-
surfaces would overlap if drawn at particular coordinates.
|
741
|
-
|
742
|
-
Only ((<SDL::Surface#makeCollisionMap>)) makes this object.
|
743
|
-
|
744
|
-
==== class method
|
745
|
-
|
746
|
-
--- SDL::CollisionMap#boundingBoxCheck(x1, y1, w1, h1, x2, y2, w2, h2)
|
747
|
-
Return true if the bounding boxes overlap.
|
748
|
-
|
749
|
-
==== method
|
750
|
-
|
751
|
-
--- SDL::CollisionMap#collisionCheck(x1, y1, collisionMap, x2, y2)
|
752
|
-
Determine if this collision map, if drawn with its upper-left
|
753
|
-
corner at (x1, y1), would collide with collisionMap if drawn
|
754
|
-
with its upper-left corner at (x2, y2). If so, return the
|
755
|
-
coordinate of the last collision found as an array ([x, y]).
|
756
|
-
If no collision, returns nil.
|
757
|
-
|
758
|
-
This method calls boundingBoxCheck automatically.
|
759
|
-
|
760
|
-
--- SDL::CollisionMap#boundingBoxCheck(x1, y1, collisionMap, x2, y2)
|
761
|
-
Return true if the bounding boxes of the two maps would overlap if
|
762
|
-
drawn with upper-left corners at (x1, y1) and (x2, y2).
|
763
|
-
|
764
|
-
--- SDL::CollisionMap#clear(x1, y1, w, h)
|
765
|
-
Clear (make transparent) an area of the collision map.
|
766
|
-
|
767
|
-
--- SDL::CollisionMap#set(x1, y1, w, h)
|
768
|
-
Set (make solid) an area of the collision map.
|
769
|
-
|
770
|
-
=== SDL::Screen
|
771
|
-
|
772
|
-
SDL display the image that the instance of "Screen" have.
|
773
|
-
Only ((<SDL.setVideoMode>)) makes this object.
|
774
|
-
In fact the class named "Screen" doesn't exist,and the object that
|
775
|
-
SDL::setVideoMode returns is the instance of Surface with following
|
776
|
-
singleton methods.
|
777
|
-
|
778
|
-
==== super class
|
779
|
-
|
780
|
-
((<SDL::Surface>))
|
781
|
-
|
782
|
-
==== class method
|
783
|
-
|
784
|
-
|
785
|
-
==== method
|
786
|
-
|
787
|
-
--- SDL::Screen#updateRect(x,y,w,h)
|
788
|
-
--- SDL::Screen#update_rect(x,y,w,h)
|
789
|
-
Makes sure the given rectangle is updated on the given screen.
|
790
|
-
Thhis function should not be called while screen is locked.
|
791
|
-
|
792
|
-
If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire
|
793
|
-
screen.
|
794
|
-
|
795
|
-
--- SDL::Screen#updateRects(*rects)
|
796
|
-
--- SDL::Screen#update_rects(*rects)
|
797
|
-
Makes sure the given list of rectangles is updated on the given screen.
|
798
|
-
Each rectagle is represented as an array of 4 elements([x, y, w, h]).
|
799
|
-
The rectangles must all be confined within the screen boundaries
|
800
|
-
(no clipping is done).
|
801
|
-
|
802
|
-
|
803
|
-
--- SDL::Screen#flip
|
804
|
-
On hardware that supports double-buffering, this method sets up a flip
|
805
|
-
and returns. The hardware will wait for vertical retrace, and then swap
|
806
|
-
video buffers before the next video surface blit or lock will return. On
|
807
|
-
hardware that doesn't support double-buffering, this is equivalent to
|
808
|
-
calling ((<SDL::Screen#updateRect>))(0, 0, 0, 0)
|
809
|
-
|
810
|
-
The SDL::DOUBLEBUF flag must have been passed to
|
811
|
-
((<SDL.setVideoMode>)), when
|
812
|
-
setting the video mode for this method to perform hardware flipping.
|
813
|
-
|
814
|
-
=== SDL::PixelFormat
|
815
|
-
|
816
|
-
((<SDL::Surface>)) has all methods of ((<SDL::PixelFormat>)).
|
817
|
-
This class is obsolete,
|
818
|
-
and you should use ((<SDL::Surface>)) instead of ((<SDL::PixelFormat>)).
|
819
|
-
|
820
|
-
In SDL you can use some type surface,for example 32bit color surface and
|
821
|
-
16bit surface.Therefore you need the information about that type,and
|
822
|
-
object of PixelFormat represents this information.
|
823
|
-
|
824
|
-
In this lib,you use one integer to specify color.To change from r,g,b value
|
825
|
-
to this integer you use ((<SDL::PixelFormat#mapRGB>)) and to change this integer
|
826
|
-
to r,g,b value ((<SDL::PixelFormat#getRGB>))
|
827
|
-
|
828
|
-
==== super class
|
829
|
-
|
830
|
-
Object
|
831
|
-
|
832
|
-
==== class method
|
833
|
-
|
834
|
-
nothing
|
835
|
-
|
836
|
-
==== method
|
837
|
-
|
838
|
-
--- SDL::PixelFormat#mapRGB(r,g,b)
|
839
|
-
Maps the RGB color value to the specified pixel format and returns the
|
840
|
-
pixel value as a integer.
|
841
|
-
|
842
|
-
--- SDL::PixelFormat#mapRGBA(r,g,b,a)
|
843
|
-
Same as above,but includes alpha value.
|
844
|
-
|
845
|
-
--- SDL::PixelFormat#getRGB(pixel)
|
846
|
-
Get RGB component values from a pixel stored in the specified pixel
|
847
|
-
format.Returns r,g,b value in array as [r,g,b].
|
848
|
-
|
849
|
-
--- SDL::PixelFormat#getRGBA(pixel)
|
850
|
-
Same as above, but return value includes alplah value.
|
851
|
-
Returns r,g,b,a in arrary as [r,g,b,a].
|
852
|
-
|
853
|
-
--- SDL::PixelFormat#bpp
|
854
|
-
Return bits per pixel on this format.
|
855
|
-
|
856
|
-
--- SDL::PixelFormat#colorkey
|
857
|
-
Not documented yet
|
858
|
-
|
859
|
-
--- SDL::PixelFormat#alpha
|
860
|
-
Not documented yet
|
861
|
-
|
862
|
-
== Event handling
|
863
|
-
|
864
|
-
=== SDL::Event
|
865
|
-
|
866
|
-
The class handling event.
|
867
|
-
You had better use ((<SDL::Event2>)) instead of this class.
|
868
|
-
|
869
|
-
==== super class
|
870
|
-
|
871
|
-
Object
|
872
|
-
|
873
|
-
==== class method
|
874
|
-
|
875
|
-
--- SDL::Event.new
|
876
|
-
Create a new ((<SDL::Event>)) Object.
|
877
|
-
|
878
|
-
--- SDL::Event.appState
|
879
|
-
--- SDL::Event.app_state
|
880
|
-
Returns the current state of the application. The value returned
|
881
|
-
is a bitwise combination of:
|
882
|
-
SDL::Event::APPMOUSEFOCUS
|
883
|
-
SDL::Event::APPINPUTFOCUS
|
884
|
-
SDL::Event::APPACTIVE
|
885
|
-
|
886
|
-
--- SDL::Event.enableUNICODE
|
887
|
-
--- SDL::Event.enable_unicode
|
888
|
-
Enables UNICODE keyboard translation.
|
889
|
-
UNICODE translation is disabled by default.
|
890
|
-
If you will use SDLSKK on Ruby/SDL, you should enable translation.
|
891
|
-
|
892
|
-
--- SDL::Event.disableUNICODE
|
893
|
-
--- SDL::Event.disable_unicode
|
894
|
-
Disable UNICODE keyboard translation.
|
895
|
-
|
896
|
-
--- SDL::Event.enableUNICODE?
|
897
|
-
--- SDL::Event.enable_unicode?
|
898
|
-
Returns whether UNICODE keyboard translation is enabled.
|
899
|
-
|
900
|
-
==== method
|
901
|
-
|
902
|
-
--- SDL::Event#poll
|
903
|
-
Polls for currently pending events, and returns 1 if there are any
|
904
|
-
pending events, or 0 if there are none available.
|
905
|
-
If there are any events ,the next event is removed from the queue
|
906
|
-
and stored in self.
|
907
|
-
|
908
|
-
--- SDL::Event#wait
|
909
|
-
Waits indefinitely for the next available event, returning 1, or 0 if
|
910
|
-
there was an error while waiting for events.
|
911
|
-
The next event is removed from the queue and stored in self.
|
912
|
-
|
913
|
-
--- SDL::Event#type
|
914
|
-
Returns the type of stored event.
|
915
|
-
SDL::Event::ACTIVEEVENT
|
916
|
-
SDL::Event::KEYDOWN
|
917
|
-
SDL::Event::KEYUP
|
918
|
-
SDL::Event::MOUSEMOTION
|
919
|
-
SDL::Event::MOUSEBUTTONDOWN
|
920
|
-
SDL::Event::MOUSEBUTTONUP
|
921
|
-
SDL::Event::JOYAXISMOTION
|
922
|
-
SDL::Event::JOYBALLMOTION
|
923
|
-
SDL::Event::JOYHATMOTION
|
924
|
-
SDL::Event::JOYBUTTONDOWN
|
925
|
-
SDL::Event::JOYBUTTONUP
|
926
|
-
SDL::Event::QUIT
|
927
|
-
SDL::Event::SYSWMEVENT
|
928
|
-
SDL::Event::VIDEORESIZE
|
929
|
-
|
930
|
-
--- SDL::Event#info
|
931
|
-
Return event information in array.
|
932
|
-
This method can handle all event.
|
933
|
-
|
934
|
-
--- SDL::Event#keyPress?
|
935
|
-
--- SDL::Event#key_press?
|
936
|
-
Returns true when you got key event and a key pressed down,
|
937
|
-
otherwise returns false.
|
938
|
-
|
939
|
-
--- SDL::Event#keySym
|
940
|
-
--- SDL::Event#key_sym
|
941
|
-
Returns SDL vertual keysym.
|
942
|
-
|
943
|
-
--- SDL::Event#keyMod
|
944
|
-
--- SDL::Event#key_mod
|
945
|
-
Returns Current Key modifiers.
|
946
|
-
|
947
|
-
--- SDL::Event#gain?
|
948
|
-
On ACTIVEEVENT,
|
949
|
-
returns true when gaining focus in this event,otherwise retursn false.
|
950
|
-
|
951
|
-
--- SDL::Event#appState
|
952
|
-
--- SDL::Event#app_state
|
953
|
-
Returns the kind of ActiveEvent.
|
954
|
-
This value is following.
|
955
|
-
SDL::Event::APPMOUSEFOCUS
|
956
|
-
SDL::Event::APPINPUTFOCUS
|
957
|
-
SDL::Event::APPACTIVE
|
958
|
-
|
959
|
-
--- SDL::Event#mouseX
|
960
|
-
--- SDL::Event#mouse_x
|
961
|
-
Returns the X coordinate of the mouse.
|
962
|
-
|
963
|
-
--- SDL::Event#mouseY
|
964
|
-
--- SDL::Event#mouse_y
|
965
|
-
Returns the Y coordinate of the mouse.
|
966
|
-
|
967
|
-
--- SDL::Event#mouseXrel
|
968
|
-
--- SDL::Event#mouse_xrel
|
969
|
-
Returns the relative motion in the X direction.
|
970
|
-
|
971
|
-
--- SDL::Event#mouseYrel
|
972
|
-
--- SDL::Event#mouse_yrel
|
973
|
-
Returns the relative motion in the Y direction.
|
974
|
-
|
975
|
-
--- SDL::Event#mouseButton
|
976
|
-
--- SDL::Event#mouse_button
|
977
|
-
Returns the mouse button index.
|
978
|
-
SDL::Mouse::BUTTON_LEFT
|
979
|
-
SDL::Mouse::BUTTON_MIDDLE
|
980
|
-
SDL::Mouse::BUTTON_RIGHT
|
981
|
-
|
982
|
-
--- SDL::Event#mousePress?
|
983
|
-
--- SDL::Event#mouse_press?
|
984
|
-
Returns true when this mouse event is SDL::Event::MOUSEBUTTONDOWN,
|
985
|
-
otherwise returns false.
|
986
|
-
|
987
|
-
=== SDL::Event2
|
988
|
-
Another event handling class.
|
989
|
-
I think ((<SDL::Event2>)) is easier to use than ((<SDL::Event>))
|
990
|
-
|
991
|
-
==== super class
|
992
|
-
|
993
|
-
Object
|
994
|
-
|
995
|
-
==== class method
|
996
|
-
|
997
|
-
--- SDL::Event2.poll
|
998
|
-
Polls for currently pending events, and returns the instance represents
|
999
|
-
that event.Returns nil if there is no pending event.
|
1000
|
-
The class of that instance is following.
|
1001
|
-
SDL::Event2::Active
|
1002
|
-
SDL::Event2::KeyDown
|
1003
|
-
SDL::Event2::KeyUp
|
1004
|
-
SDL::Event2::MouseMotion
|
1005
|
-
SDL::Event2::MouseButtonDown
|
1006
|
-
SDL::Event2::MouseButtonUp
|
1007
|
-
SDL::Event2::JoyAxis
|
1008
|
-
SDL::Event2::JoyBall
|
1009
|
-
SDL::Event2::JoyHat
|
1010
|
-
SDL::Event2::JoyButtonUp
|
1011
|
-
SDL::Event2::JoyButtonDown
|
1012
|
-
SDL::Event2::Quit
|
1013
|
-
SDL::Event2::SysWM
|
1014
|
-
SDL::Event2::VideoResize
|
1015
|
-
All of these classes are subclass of SDL::Event2.
|
1016
|
-
|
1017
|
-
--- SDL::Event2.wait
|
1018
|
-
Waits indefinitely for the next available event,returning the instance
|
1019
|
-
represents that event.
|
1020
|
-
|
1021
|
-
Note that while waiting next event, ruby's interpreter is blocked
|
1022
|
-
and it cannot switch other threads because ruby's thread is
|
1023
|
-
user-level thread.
|
1024
|
-
|
1025
|
-
--- SDL::Event2.push(event)
|
1026
|
-
Not documented yet.
|
1027
|
-
|
1028
|
-
--- SDL::Event2.new
|
1029
|
-
Not documented yet.
|
1030
|
-
|
1031
|
-
--- SDL::Event2.appState
|
1032
|
-
--- SDL::Event2.app_state
|
1033
|
-
Same as ((<SDL::Event.appState>)).
|
1034
|
-
|
1035
|
-
--- SDL::Event2.enableUNICODE
|
1036
|
-
--- SDL::Event2.enable_unicode
|
1037
|
-
Same as ((<SDL::Event.enableUNICODE>)).
|
1038
|
-
|
1039
|
-
--- SDL::Event2.disableUNICODE
|
1040
|
-
--- SDL::Event2.disable_unicode
|
1041
|
-
Same as ((<SDL::Event2.disableUNICODE>)).
|
1042
|
-
|
1043
|
-
--- SDL::Event2.enableUNICODE?
|
1044
|
-
--- SDL::Event2.enable_unicode?
|
1045
|
-
Same as ((<SDL::Event.enableUNICODE?>)).
|
1046
|
-
|
1047
|
-
==== method
|
1048
|
-
|
1049
|
-
Nothing
|
1050
|
-
|
1051
|
-
=== subclasses of SDL::Event2
|
1052
|
-
SDL::Event2.poll and SDL::Event2.wait return the instance of
|
1053
|
-
the subclasses of SDL::Event2.
|
1054
|
-
These classes and following.
|
1055
|
-
|
1056
|
-
==== SDL::Event2::Active
|
1057
|
-
This event occurs when mouse/keyboard focus gains/loss.
|
1058
|
-
+ Method
|
1059
|
-
--- SDL::Event2::Active#gain
|
1060
|
-
Returns true focus gains, otherwise returns false
|
1061
|
-
--- SDL::Event2::Active#state
|
1062
|
-
Returns the kind of event.
|
1063
|
-
SDL::Event::APPMOUSEFOCUS
|
1064
|
-
SDL::Event::APPINPUTFOCUS
|
1065
|
-
SDL::Event::APPACTIVE iconify or restored.
|
1066
|
-
|
1067
|
-
==== SDL::Event2::KeyDown
|
1068
|
-
This event occurs when a key is pressed.
|
1069
|
-
+ Method
|
1070
|
-
--- SDL::Event2::KeyDown#press
|
1071
|
-
Returns true.
|
1072
|
-
--- SDL::Event2::KeyDown#sym
|
1073
|
-
Returns the pressed key such as SDL::Key::ESCAPE.
|
1074
|
-
--- SDL::Event2::KeyDown#mod
|
1075
|
-
Same as ((<SDL::Key.modState>)).
|
1076
|
-
--- SDL::Event2::KeyDown#unicode
|
1077
|
-
Returns key input translated to UNICODE.If you will use this,
|
1078
|
-
you need to call ((<SDL::Event2.enableUNICODE>)) beforehand.
|
1079
|
-
==== SDL::Event2::KeyUp
|
1080
|
-
This event occurs when a key is released.
|
1081
|
-
+ Method
|
1082
|
-
--- SDL::Event2::KeyUp#press
|
1083
|
-
Returns false.
|
1084
|
-
--- SDL::Event2::KeyUp#sym
|
1085
|
-
Returns the released key such as SDL::Key::ESCAPE.
|
1086
|
-
--- SDL::Event2::KeyUp#mod
|
1087
|
-
Same as ((<SDL::Key.modState>)).
|
1088
|
-
|
1089
|
-
==== SDL::Event2::MouseMotion
|
1090
|
-
This event occurs when mouse is moved.
|
1091
|
-
+ Method
|
1092
|
-
--- SDL::Event2::MouseMotion#state
|
1093
|
-
Returns the button state.
|
1094
|
-
--- SDL::Event2::MouseMotion#x
|
1095
|
-
Returns x of mouse cursor.
|
1096
|
-
--- SDL::Event2::MouseMotion#y
|
1097
|
-
Returns y of mouse cursor.
|
1098
|
-
--- SDL::Event2::MouseMotion#xrel
|
1099
|
-
Returns relative x coordinates.
|
1100
|
-
--- SDL::Event2::MouseMotion#yrel
|
1101
|
-
Returns relative y coordinates.
|
1102
|
-
|
1103
|
-
==== SDL::Event2::MouseButtonDown
|
1104
|
-
This event occurs when a mouse button is pressed.
|
1105
|
-
+ Method
|
1106
|
-
--- SDL::Event2::MouseButtonDown#button
|
1107
|
-
Returns the which button is pressed.
|
1108
|
-
SDL::Mouse::BUTTON_LEFT
|
1109
|
-
SDL::Mouse::BUTTON_MIDDLE
|
1110
|
-
SDL::Mouse::BUTTON_RIGHT
|
1111
|
-
|
1112
|
-
--- SDL::Event2::MouseButtonDown#press
|
1113
|
-
Returns true.
|
1114
|
-
--- SDL::Event2::MouseButtonDown#x
|
1115
|
-
Returns x of mouse cursor.
|
1116
|
-
--- SDL::Event2::MouseButtonDown#y
|
1117
|
-
Returns y of mouse cursor.
|
1118
|
-
|
1119
|
-
==== SDL::Event2::MouseButtonUp
|
1120
|
-
This event occurs when a mouse button is pressed.
|
1121
|
-
+ Method
|
1122
|
-
--- SDL::Event2::MouseButtonUp#button
|
1123
|
-
Returns the which button is released.
|
1124
|
-
SDL::Mouse::BUTTON_LEFT
|
1125
|
-
SDL::Mouse::BUTTON_MIDDLE
|
1126
|
-
SDL::Mouse::BUTTON_RIGHT
|
1127
|
-
|
1128
|
-
--- SDL::Event2::MouseButtonUp#press
|
1129
|
-
Returns false.
|
1130
|
-
--- SDL::Event2::MouseButtonUp#x
|
1131
|
-
Returns x of mouse cursor.
|
1132
|
-
--- SDL::Event2::MouseButtonUp#y
|
1133
|
-
Returns y of mouse cursor.
|
1134
|
-
|
1135
|
-
==== SDL::Event2::JoyAxis
|
1136
|
-
This event occurs when axis of joystick is moved.
|
1137
|
-
+ Method
|
1138
|
-
--- SDL::Event2::JoyAxis#which
|
1139
|
-
Returns joystick device index.
|
1140
|
-
--- SDL::Event2::JoyAxis#axis
|
1141
|
-
Returns joystick axis index.
|
1142
|
-
--- SDL::Event2::JoyAxis#value
|
1143
|
-
Returns axis value(from -32768 to 32767).
|
1144
|
-
|
1145
|
-
==== SDL::Event2::JoyBall
|
1146
|
-
This event occurs when joystick trackball moves.
|
1147
|
-
+ Method
|
1148
|
-
--- SDL::Event2::JoyBall#which
|
1149
|
-
Returns joystick device index.
|
1150
|
-
--- SDL::Event2::JoyBall#ball
|
1151
|
-
Returns joystick trackball index.
|
1152
|
-
--- SDL::Event2::JoyBall#xrel
|
1153
|
-
Returns the relative motion in the X direction.
|
1154
|
-
--- SDL::Event2::JoyBall#yrel
|
1155
|
-
Returns the relative motion in the Y direction.
|
1156
|
-
|
1157
|
-
==== SDL::Event2::JoyHat
|
1158
|
-
This event occurs when joystick hat moves.
|
1159
|
-
+ Method
|
1160
|
-
--- SDL::Event2::JoyHat#which
|
1161
|
-
Returns joystick device index.
|
1162
|
-
--- SDL::Event2::JoyHat#hat
|
1163
|
-
Returns joystick hat index.
|
1164
|
-
--- SDL::Event2::JoyHat#value
|
1165
|
-
Returns hat position.
|
1166
|
-
That values is a logically OR'd combination
|
1167
|
-
of the following values.
|
1168
|
-
SDL::Joystick::HAT_CENTERED
|
1169
|
-
SDL::Joystick::HAT_UP
|
1170
|
-
SDL::Joystick::HAT_RIGHT
|
1171
|
-
SDL::Joystick::HAT_DOWN
|
1172
|
-
SDL::Joystick::HAT_LEFT
|
1173
|
-
|
1174
|
-
The following defines are also provided
|
1175
|
-
SDL::Joystick::HAT_RIGHTUP
|
1176
|
-
SDL::Joystick::HAT_RIGHTDOWN
|
1177
|
-
SDL::Joystick::HAT_LEFTUP
|
1178
|
-
SDL::Joystick::HAT_LEFTDOWN
|
1179
|
-
|
1180
|
-
==== SDL::Event2::JoyButtonUp
|
1181
|
-
This event occurs when joystick button is released.
|
1182
|
-
+ Method
|
1183
|
-
--- SDL::Event2::JoyButtonUp#which
|
1184
|
-
Returns joystick device index.
|
1185
|
-
--- SDL::Event2::JoyButtonUp#button
|
1186
|
-
Returns joystick button index.
|
1187
|
-
--- SDL::Event2::JoyButtonUp#press
|
1188
|
-
Returns false.
|
1189
|
-
|
1190
|
-
==== SDL::Event2::JoyButtonDown
|
1191
|
-
This event occurs when joysick button is pressed.
|
1192
|
-
+ Method
|
1193
|
-
--- SDL::Event2::JoyButtonDown#which
|
1194
|
-
Returns joystick device index.
|
1195
|
-
--- SDL::Event2::JoyButtonDown#button
|
1196
|
-
Returns joystick button index.
|
1197
|
-
--- SDL::Event2::JoyButtonDown#press
|
1198
|
-
Returns true.
|
1199
|
-
|
1200
|
-
==== SDL::Event2::Quit
|
1201
|
-
This event occurs when quit requested, such as pressed exit button.
|
1202
|
-
|
1203
|
-
==== SDL::Event2::SysWM
|
1204
|
-
This event occurs when platform-dependent window manager occurs.
|
1205
|
-
You can't get more information.
|
1206
|
-
|
1207
|
-
==== SDL::Event2::VideoResize
|
1208
|
-
This event occurs when window are resized.
|
1209
|
-
You will get this event only when you call ((<SDL.setVideoMode>)) with
|
1210
|
-
SDL::RESIZABLE.
|
1211
|
-
|
1212
|
-
+ Method
|
1213
|
-
--- SDL::Event2::VideoResize#w
|
1214
|
-
Returns new width of window.
|
1215
|
-
--- SDL::Event2::VideoResize#h
|
1216
|
-
Returns new height of window.
|
1217
|
-
|
1218
|
-
=== SDL::Key
|
1219
|
-
|
1220
|
-
The module defines key constants.
|
1221
|
-
This module has some functions to get the key state.
|
1222
|
-
|
1223
|
-
==== module functions
|
1224
|
-
|
1225
|
-
--- SDL::Key.scan
|
1226
|
-
scan key state.
|
1227
|
-
|
1228
|
-
--- SDL::Key.press?(key)
|
1229
|
-
Get key state that "scan" function scan.
|
1230
|
-
return true if "key" is pressed and return false if "key" is released.
|
1231
|
-
|
1232
|
-
--- SDL::Key.modState
|
1233
|
-
--- SDL::Key.mod_state
|
1234
|
-
Returns the current of the modifier keys (CTRL,ATL,etc.).
|
1235
|
-
The return value can be an OR'd combination of following constants.
|
1236
|
-
SDL::Key::MOD_NONE
|
1237
|
-
SDL::Key::MOD_LSHIFT
|
1238
|
-
SDL::Key::MOD_RSHIFT
|
1239
|
-
SDL::Key::MOD_LCTRL
|
1240
|
-
SDL::Key::MOD_RCTRL
|
1241
|
-
SDL::Key::MOD_LALT
|
1242
|
-
SDL::Key::MOD_RALT
|
1243
|
-
SDL::Key::MOD_LMETA
|
1244
|
-
SDL::Key::MOD_RMETA
|
1245
|
-
SDL::Key::MOD_NUM
|
1246
|
-
SDL::Key::MOD_CAPS
|
1247
|
-
SDL::Key::MOD_MODE
|
1248
|
-
SDL::Key::MOD_RESERVED
|
1249
|
-
SDL::Key::MOD_CTRL = SDL::Key::MOD_LCTRL|SDL::Key::MOD_RCTRL
|
1250
|
-
SDL::Key::MOD_SHIFT = SDL::Key::MOD_LSHIFT|SDL::Key::MOD_RSHIFT
|
1251
|
-
SDL::Key::MOD_ALT = SDL::Key::MOD_LALT|SDL::Key::MOD_RALT
|
1252
|
-
SDL::Key::MOD_META = SDL::Key::MOD_LMETA|SDL::Key::MOD_RMETA
|
1253
|
-
|
1254
|
-
--- SDL::Key.enableKeyRepeat(delay,interval)
|
1255
|
-
--- SDL::Key.enable_key_repeat(delay,interval)
|
1256
|
-
Set keyboard repeat rate.
|
1257
|
-
|
1258
|
-
--- SDL::Key.disableKeyRepeat
|
1259
|
-
--- SDL::Key.disable_key_repeat
|
1260
|
-
Disables key repeat.
|
1261
|
-
|
1262
|
-
--- SDL::Key.getKeyName(key)
|
1263
|
-
--- SDL::Key.get_key_name(key)
|
1264
|
-
Return the string of key name.
|
1265
|
-
|
1266
|
-
=== SDL::Mouse
|
1267
|
-
|
1268
|
-
The module mouse constants and mouse functions.
|
1269
|
-
|
1270
|
-
=== module functions
|
1271
|
-
|
1272
|
-
--- SDL::Mouse.state
|
1273
|
-
Return mouse state in array.
|
1274
|
-
Return value is following,
|
1275
|
-
[ x , y , pressLButton? , pressMButton? , pressRButton? ]
|
1276
|
-
|
1277
|
-
--- SDL::Mouse.warp(x,y)
|
1278
|
-
Set the position of the mouse cursor (generates a mouse motion event).
|
1279
|
-
|
1280
|
-
--- SDL::Mouse.show
|
1281
|
-
Show mouse cursor.
|
1282
|
-
|
1283
|
-
--- SDL::Mouse.hide
|
1284
|
-
Hide mouse cursor.
|
1285
|
-
|
1286
|
-
--- SDL::Mouse.setCursor(bitmap,white,black,transparent,inverted,hot_x=0,hot_y=0)
|
1287
|
-
--- SDL::Mouse.set_cursor(bitmap,white,black,transparent,inverted,hot_x=0,hot_y=0)
|
1288
|
-
Change mouse cursor. bitmap is form of cursor,instance of
|
1289
|
-
((<SDL::Surface>)).The cursor width must be a multiple of 8.
|
1290
|
-
The cursor is created in black and white according to
|
1291
|
-
bitmap and white,black,transparent,inverted.
|
1292
|
-
white,black,transparent,inverted represents that elements in
|
1293
|
-
bitmap as pixel value.
|
1294
|
-
|
1295
|
-
== audio
|
1296
|
-
|
1297
|
-
=== SDL::Mixer
|
1298
|
-
|
1299
|
-
The module that have sound functions and constants.
|
1300
|
-
Note that volume is between 0 and 128.
|
1301
|
-
Needs SDL_mixer to use functions if this module.
|
1302
|
-
|
1303
|
-
==== module functions
|
1304
|
-
|
1305
|
-
--- SDL::Mixer.open(frequency=Mixer::DEFAULT_FREQUENCY,format=Mixer::DEFAULT_FORMAT,cannels=Mixer::DEFAULT_CHANNELS,chunksize=4096)
|
1306
|
-
Initializes SDL_mixer.
|
1307
|
-
|
1308
|
-
--- SDL::Mixer.spec
|
1309
|
-
Returns the audio spec in array.
|
1310
|
-
[ rate,format,channels ]
|
1311
|
-
|
1312
|
-
--- SDL::Mixer.driverName
|
1313
|
-
--- SDL::Mixer.driver_name
|
1314
|
-
Returns the current audio device name.
|
1315
|
-
Raises SDL::Error if mixer is not initialized yet.
|
1316
|
-
|
1317
|
-
--- SDL::Mixer.allocateChannels(numchannels)
|
1318
|
-
--- SDL::Mixer.allocate_channels(numchannels)
|
1319
|
-
Dynamically change the number of channels managed by the mixer.
|
1320
|
-
If decreasing the number of channels, the upper channels are
|
1321
|
-
stopped.
|
1322
|
-
This method returns the new number of allocated channels.
|
1323
|
-
|
1324
|
-
--- SDL::Mixer.playChannel(channel,wave,looping)
|
1325
|
-
--- SDL::Mixer.play_channel(channel,wave,looping)
|
1326
|
-
Play a wave on a specific channel.
|
1327
|
-
|
1328
|
-
If the specified channel is -1, play on the first free channel.
|
1329
|
-
If 'loops' is greater than zero, loop the sound that many times.
|
1330
|
-
If 'loops' is -1, loop inifinitely (~65000 times).
|
1331
|
-
|
1332
|
-
Returns which channel was used to play the sound.
|
1333
|
-
|
1334
|
-
--- SDL::Mixer.play?(channel)
|
1335
|
-
Returns whether specific channel is playing or not.
|
1336
|
-
|
1337
|
-
If the specified channel is -1, check all channels.
|
1338
|
-
|
1339
|
-
--- SDL::Mixer.setVolume(channel,volume)
|
1340
|
-
--- SDL::Mixer.set_volume(channel,volume)
|
1341
|
-
Set the volume in the range of 0-128 of a specific channel.
|
1342
|
-
If the specified channel is -1, set volume for all channels.
|
1343
|
-
Returns the original volume.
|
1344
|
-
If the specified volume is -1, just return the current volume.
|
1345
|
-
|
1346
|
-
--- SDL::Mixer.halt(channel)
|
1347
|
-
Halt playing of a particular channel
|
1348
|
-
|
1349
|
-
--- SDL::Mixer.pause(chennel)
|
1350
|
-
Pause a particular channel
|
1351
|
-
|
1352
|
-
--- SDL::Mixer.resume(channel)
|
1353
|
-
Resume a particular channel
|
1354
|
-
|
1355
|
-
--- SDL::Mixer.pause?(channel)
|
1356
|
-
Returns whether a particular channel is pausing.
|
1357
|
-
|
1358
|
-
--- SDL::Mixer.playMusic(music,loops)
|
1359
|
-
--- SDL::Mixer.play_music(music,loops)
|
1360
|
-
Play a music.
|
1361
|
-
|
1362
|
-
--- SDL::Mixer.fadeInMusic(music,loops,ms)
|
1363
|
-
--- SDL::Mixer.fade_in_music(music,loops,ms)
|
1364
|
-
Fade in the given music in ms milliseconds.
|
1365
|
-
The meaning of loops is same as in ((<SDL::Mixer.playChannel>))
|
1366
|
-
|
1367
|
-
--- SDL::Mixer.setVolumeMusic(volume)
|
1368
|
-
--- SDL::Mixer.set_volume_music(volume)
|
1369
|
-
Sets the volume of music.
|
1370
|
-
|
1371
|
-
--- SDL::Mixer.haltMusic
|
1372
|
-
--- SDL::Mixer.halt_music
|
1373
|
-
Halts music.
|
1374
|
-
|
1375
|
-
--- SDL::Mixer.fadeOutMusic(ms)
|
1376
|
-
--- SDL::Mixer.fade_out_music(ms)
|
1377
|
-
Fade out the music in ms milliseconds.
|
1378
|
-
|
1379
|
-
--- SDL::Mixer.pauseMusic
|
1380
|
-
--- SDL::Mixer.pause_music
|
1381
|
-
Pauses music.
|
1382
|
-
|
1383
|
-
--- SDL::Mixer.resumeMusic
|
1384
|
-
--- SDL::Mixer.resume_music
|
1385
|
-
Resumes music.
|
1386
|
-
|
1387
|
-
--- SDL::Mixer.rewindMusic
|
1388
|
-
--- SDL::Mixer.rewind_music
|
1389
|
-
Rewinds music.
|
1390
|
-
|
1391
|
-
--- SDL::Mixer.pauseMusic?
|
1392
|
-
--- SDL::Mixer.pause_music?
|
1393
|
-
Returns whether the music is pausing.
|
1394
|
-
|
1395
|
-
--- SDL::Mixer.playMusic?
|
1396
|
-
--- SDL::Mixer.play_music?
|
1397
|
-
Returns whether the music is playing.
|
1398
|
-
|
1399
|
-
=== SDL::Mixer::Wave
|
1400
|
-
|
1401
|
-
The class handling wave
|
1402
|
-
|
1403
|
-
==== super class
|
1404
|
-
|
1405
|
-
Object
|
1406
|
-
|
1407
|
-
==== class method
|
1408
|
-
|
1409
|
-
--- SDL::Mixer::Wave.load(filename)
|
1410
|
-
Loads a wave file and returns the object of ((<SDL::Mixer::Wave>)).
|
1411
|
-
|
1412
|
-
==== method
|
1413
|
-
|
1414
|
-
--- SDL::Mixer::Wave#setVolume(volume)
|
1415
|
-
--- SDL::Mixer::Wave#set_volume(volume)
|
1416
|
-
Set volume of self.
|
1417
|
-
|
1418
|
-
=== SDL::Mixer::Music
|
1419
|
-
|
1420
|
-
==== super class
|
1421
|
-
|
1422
|
-
Object
|
1423
|
-
|
1424
|
-
==== class method
|
1425
|
-
|
1426
|
-
--- SDL::Mixer::Music.load(filename)
|
1427
|
-
Loads a music (.mod .s3m .it .xm .mid .mp3, .ogg) file and returns the
|
1428
|
-
object of ((<SDL::Mixer::Music>)).
|
1429
|
-
|
1430
|
-
You have to setup your environment to play MIDI, Ogg Vorbis, and MP3 file.
|
1431
|
-
|
1432
|
-
== Window Manager
|
1433
|
-
|
1434
|
-
=== SDL::WM
|
1435
|
-
|
1436
|
-
The module that have the functions for window management.
|
1437
|
-
|
1438
|
-
==== module functions
|
1439
|
-
|
1440
|
-
--- SDL::WM.caption
|
1441
|
-
Returns captions of the window title and icon name.
|
1442
|
-
|
1443
|
-
--- SDL::WM.setCaption(title,icon)
|
1444
|
-
--- SDL::WM.set_caption(title,icon)
|
1445
|
-
Set captions of the window title and icon name.
|
1446
|
-
|
1447
|
-
--- SDL::WM.icon=(iconImage)
|
1448
|
-
--- SDL::WM.icon=(icon_image)
|
1449
|
-
Sets the icon for the display window.
|
1450
|
-
|
1451
|
-
This function must be called before the first call to
|
1452
|
-
setVideoMode.
|
1453
|
-
|
1454
|
-
It takes an icon surface.
|
1455
|
-
|
1456
|
-
--- SDL::WM.iconify
|
1457
|
-
If the application is running in a window managed environment SDL
|
1458
|
-
attempts to iconify/minimise it. If ((<SDL::WM.iconify>)) is successful,
|
1459
|
-
the application will receive a APPACTIVE loss event.
|
1460
|
-
|
1461
|
-
--- SDL::Screen#toggleFullScreen
|
1462
|
-
--- SDL::Screen#toggle_fullscreen
|
1463
|
-
Toggles fullscreen mode.
|
1464
|
-
|
1465
|
-
== CDROM
|
1466
|
-
|
1467
|
-
=== SDL::CD
|
1468
|
-
|
1469
|
-
The class represents CDROM drive.
|
1470
|
-
|
1471
|
-
Note that the information that you get with ((<SDL::CD#numTracks>)) is stored
|
1472
|
-
when you call ((<SDL::CD#status>)).
|
1473
|
-
|
1474
|
-
A CD-ROM is organized into one or more tracks, each consisting of a
|
1475
|
-
certain number of "frames". Each frame is ~2K in size, and at normal
|
1476
|
-
playing speed, a CD plays 75 frames per second. SDL works with the
|
1477
|
-
number of frames on a CD.
|
1478
|
-
|
1479
|
-
==== super class
|
1480
|
-
|
1481
|
-
==== class method
|
1482
|
-
|
1483
|
-
--- SDL::CD.numDrive
|
1484
|
-
--- SDL::CD.num_drive
|
1485
|
-
Returns the number of CD-ROM drives on the system.
|
1486
|
-
|
1487
|
-
--- SDL::CD.indexName(drive)
|
1488
|
-
--- SDL::CD.index_name(drive)
|
1489
|
-
Returns a human-readable, system-dependent identifier for the CD-ROM.
|
1490
|
-
drive is the index of the drive. Drive indices start to 0 and end at
|
1491
|
-
SDL::CD.numDrive-1
|
1492
|
-
|
1493
|
-
--- SDL::CD.open(drive)
|
1494
|
-
Opens a CD-ROM drive for access.
|
1495
|
-
It returns a object of CD.
|
1496
|
-
Raises SDL::Error if the drive was invalid or busy.
|
1497
|
-
Drives are numbered starting with 0. Drive 0 is the system default
|
1498
|
-
CD-ROM.
|
1499
|
-
|
1500
|
-
==== method
|
1501
|
-
|
1502
|
-
--- SDL::CD#status
|
1503
|
-
Stores the information of currentTrack,currentFrame,numTracks,trackType,
|
1504
|
-
trackLenght .
|
1505
|
-
This function returns the current status.
|
1506
|
-
Status is described like so:
|
1507
|
-
SDL::CD::TRAYEMPTY
|
1508
|
-
SDL::CD::STOPPED
|
1509
|
-
SDL::CD::PLAYING
|
1510
|
-
SDL::CD::PAUSED
|
1511
|
-
SDL::CD::ERROR
|
1512
|
-
|
1513
|
-
--- SDL::CD#play(start,length)
|
1514
|
-
Plays the given cdrom, starting a frame start for length frames.
|
1515
|
-
|
1516
|
-
--- SDL::CD#playTrack(start_track,start_frame,ntracks,nframes)
|
1517
|
-
--- SDL::CD#play_track(start_track,start_frame,ntracks,nframes)
|
1518
|
-
SDL_CDPlayTracks plays the given CD starting at track start_track, for
|
1519
|
-
ntracks tracks.
|
1520
|
-
|
1521
|
-
start_frame is the frame offset, from the beginning of the start_track,
|
1522
|
-
at which to start. nframes is the frame offset, from the beginning of
|
1523
|
-
the last track (start_track+ntracks), at which to end playing.
|
1524
|
-
|
1525
|
-
SDL::CD#playTracks should only be called after calling
|
1526
|
-
((<SDL::CD#status>)) to get track information about the CD.
|
1527
|
-
|
1528
|
-
--- SDL::CD#pause
|
1529
|
-
Pauses play.
|
1530
|
-
|
1531
|
-
--- SDL::CD#resume
|
1532
|
-
Resumes play.
|
1533
|
-
|
1534
|
-
--- SDL::CD#stop
|
1535
|
-
Stops play.
|
1536
|
-
|
1537
|
-
--- SDL::CD#eject
|
1538
|
-
Ejects cdrom.
|
1539
|
-
|
1540
|
-
--- SDL::CD#numTracks
|
1541
|
-
--- SDL::CD#num_tracks
|
1542
|
-
Returns the number of tracks on the CD.
|
1543
|
-
|
1544
|
-
--- SDL::CD#currentTrack
|
1545
|
-
--- SDL::CD#current_track
|
1546
|
-
Returns current track.
|
1547
|
-
|
1548
|
-
--- SDL::CD#currentFrame
|
1549
|
-
--- SDL::CD#current_frame
|
1550
|
-
Returns current frame.
|
1551
|
-
|
1552
|
-
--- SDL::CD#trackType(track)
|
1553
|
-
--- SDL::CD#track_type(track)
|
1554
|
-
Returns the track type of given track.
|
1555
|
-
SDL::CD::AUDIO_TRACK
|
1556
|
-
SDL::CD::DATA_TRACK
|
1557
|
-
|
1558
|
-
--- SDL::CD#trackLength(track)
|
1559
|
-
--- SDL::CD#track_length(track)
|
1560
|
-
Returns the track length in frame,of given track.
|
1561
|
-
|
1562
|
-
== Joystick handling
|
1563
|
-
|
1564
|
-
=== SDL::Joystick
|
1565
|
-
|
1566
|
-
The class represents one joystick.
|
1567
|
-
|
1568
|
-
=== super class
|
1569
|
-
|
1570
|
-
Object
|
1571
|
-
|
1572
|
-
=== class method
|
1573
|
-
|
1574
|
-
--- SDL::Joystick.pall
|
1575
|
-
Return whether ((<SDL::Joystick.updateAll>)) is called automatically.
|
1576
|
-
|
1577
|
-
--- SDL::JoyStick.pall=(polling)
|
1578
|
-
Set whether ((<SDL::Joystick.updateAll>)) is called automatically and
|
1579
|
-
whether joystick events are processed.
|
1580
|
-
Default is true, and you shouldn't change.
|
1581
|
-
|
1582
|
-
--- SDL::Joystick.num
|
1583
|
-
Returns the number of attached joysticks.
|
1584
|
-
|
1585
|
-
--- SDL::Joystick.indexName(index)
|
1586
|
-
--- SDL::Joystick.index_name(index)
|
1587
|
-
Get the implementation dependent name of joystick. The index parameter
|
1588
|
-
refers to the N'th joystick on the system.
|
1589
|
-
|
1590
|
-
--- SDL::Joystick.open(index)
|
1591
|
-
Opens a joystick for use within SDL. The index refers to the N'th
|
1592
|
-
joystick in the system. A joystick must be opened before it game be
|
1593
|
-
used.
|
1594
|
-
Returns the object of Joystick.
|
1595
|
-
|
1596
|
-
--- SDL::Joystick.open?(index)
|
1597
|
-
Determines whether a joystick has already been opened within the
|
1598
|
-
application. index refers to the N'th joystick on the system.
|
1599
|
-
|
1600
|
-
--- SDL::Joystick.updateAll
|
1601
|
-
--- SDL::Joystick.update_all
|
1602
|
-
--- SDL::Joystick.update
|
1603
|
-
Updates the state(position, buttons, etc.) of all open joysticks.
|
1604
|
-
|
1605
|
-
=== method
|
1606
|
-
|
1607
|
-
--- SDL::Joystick#index
|
1608
|
-
Returns the index of self.
|
1609
|
-
|
1610
|
-
--- SDL::Joystick#numAxes
|
1611
|
-
--- SDL::Joystick#num_axes
|
1612
|
-
Return the number of axes available from a previously opened
|
1613
|
-
joystick.
|
1614
|
-
|
1615
|
-
--- SDL::Joystick#numBalls
|
1616
|
-
--- SDL::Joystick#num_balls
|
1617
|
-
Return the number of trackballs available.
|
1618
|
-
|
1619
|
-
--- SDL::Joystick#numButtons
|
1620
|
-
--- SDL::Joystick#num_buttons
|
1621
|
-
Returns the number of buttons available.
|
1622
|
-
|
1623
|
-
--- SDL::Joystick#axis(axis_index)
|
1624
|
-
Returns a 16-bit signed integer representing the current position of the
|
1625
|
-
axis.
|
1626
|
-
On most modern joysticks the X axis is usually represented by axis 0 and
|
1627
|
-
the Y axis by axis 1. The value returned by Joystick#axis is a
|
1628
|
-
signed integer (-32768 to 32768) representing the current position of
|
1629
|
-
the axis, it maybe necessary to impose certain tolerances on these
|
1630
|
-
values to account for jitter. It is worth noting that some joysticks use
|
1631
|
-
axes 2 and 3 for extra buttons.
|
1632
|
-
|
1633
|
-
--- SDL::Joystick#hat(hat_index)
|
1634
|
-
The current state is returned as a 8bit unsigned integer
|
1635
|
-
which is defined as an OR'd combination of one or more of the following
|
1636
|
-
SDL::Joystick::HAT_CENTERED
|
1637
|
-
SDL::Joystick::HAT_UP
|
1638
|
-
SDL::Joystick::HAT_RIGHT
|
1639
|
-
SDL::Joystick::HAT_DOWN
|
1640
|
-
SDL::Joystick::HAT_LEFT
|
1641
|
-
SDL::Joystick::HAT_RIGHTUP
|
1642
|
-
SDL::Joystick::HAT_RIGHTDOWN
|
1643
|
-
SDL::Joystick::HAT_LEFTUP
|
1644
|
-
SDL::Joystick::HAT_LEFTDOWN
|
1645
|
-
|
1646
|
-
--- SDL::Joystick#button(button_index)
|
1647
|
-
Returns the current state of the given button.
|
1648
|
-
Returns true if the button is pressed,otherwise 0.
|
1649
|
-
|
1650
|
-
--- SDL::Joystick#ball(ball_index)
|
1651
|
-
Returns the motion deltas in array, [ dx,dy ] .
|
1652
|
-
Trackballs can only return relative motion since the last call to
|
1653
|
-
Joystick#ball, these motion deltas a placed into dx and dy.
|
1654
|
-
|
1655
|
-
== Font handling
|
1656
|
-
|
1657
|
-
=== SDL::BMFont
|
1658
|
-
|
1659
|
-
The class handles BitMap Font. This needs SGE.
|
1660
|
-
|
1661
|
-
==== super class
|
1662
|
-
|
1663
|
-
Object
|
1664
|
-
|
1665
|
-
==== class method
|
1666
|
-
|
1667
|
-
--- SDL::BMFont.open(filename,flags)
|
1668
|
-
Open a font file and create a bitmap font object.
|
1669
|
-
* SDL::BMFont::TRANSPARENT
|
1670
|
-
Transparent(Should usually be set)
|
1671
|
-
* SDL::BMFont::NOCONVERT
|
1672
|
-
* SDL::BMFont::SFONT
|
1673
|
-
* SDL::BMFont::PALETTE
|
1674
|
-
|
1675
|
-
==== method
|
1676
|
-
--- SDL::BMFont#setColor(r,g,b)
|
1677
|
-
--- SDL::BMFont#set_color
|
1678
|
-
Changes the color of the font.
|
1679
|
-
This doesn't work on 'color font' or sfont.
|
1680
|
-
|
1681
|
-
--- SDL::BMFont#height
|
1682
|
-
Get the height of the font.
|
1683
|
-
|
1684
|
-
--- SDL::BMFont#width
|
1685
|
-
Get the width of the font.
|
1686
|
-
|
1687
|
-
--- SDL::BMFont#textout(surface,string,x,y)
|
1688
|
-
Render the given string on surface. (x,y) is the position
|
1689
|
-
of the left top corner.
|
1690
|
-
|
1691
|
-
=== SDL::Kanji
|
1692
|
-
This class handles bdf fonts. You can draw Japanese character with this
|
1693
|
-
class.
|
1694
|
-
|
1695
|
-
==== super class
|
1696
|
-
|
1697
|
-
Object
|
1698
|
-
|
1699
|
-
==== class method
|
1700
|
-
--- SDL::Kanji.open(filename,size)
|
1701
|
-
Open bdf font file and return font object.
|
1702
|
-
You should specify font size as ((|size|)).
|
1703
|
-
|
1704
|
-
==== method
|
1705
|
-
--- SDL::Kanji#add(filename)
|
1706
|
-
Open other bdf file and add lacked glyphs.
|
1707
|
-
|
1708
|
-
--- SDL::Kanji#setCodingSystem
|
1709
|
-
--- SDL::Kanji#set_coding_system
|
1710
|
-
Set Character coding system. You can use following.
|
1711
|
-
* SDL::Kanji::JIS
|
1712
|
-
* SDL::Kanji::SJIS
|
1713
|
-
* SDL::Kanji::EUC
|
1714
|
-
|
1715
|
-
Default is SDL::Kanji::EUC.
|
1716
|
-
|
1717
|
-
--- SDL::Kanji#textwidth(text)
|
1718
|
-
Return the width of text.
|
1719
|
-
|
1720
|
-
--- SDL::Kanji#width
|
1721
|
-
Return the width of one ascii character.
|
1722
|
-
|
1723
|
-
--- SDL::Kanji#height
|
1724
|
-
Return font height.
|
1725
|
-
|
1726
|
-
--- SDL::Kanji#put(surface,text,x,y,r,g,b)
|
1727
|
-
Draw text on surface at (x,y) whose color is (r,g,b).
|
1728
|
-
|
1729
|
-
--- SDL::Kanji#putTate(surface,text,x,y,r,g,b)
|
1730
|
-
--- SDL::Kanji#put_tate(surface,text,x,y,r,g,b)
|
1731
|
-
Draw Tategaki text.
|
1732
|
-
|
1733
|
-
=== SDL::TTF
|
1734
|
-
|
1735
|
-
The class handles True Type Font. This needs SDL_ttf.
|
1736
|
-
|
1737
|
-
==== super class
|
1738
|
-
|
1739
|
-
Object
|
1740
|
-
|
1741
|
-
==== class method
|
1742
|
-
|
1743
|
-
--- SDL::TTF.init
|
1744
|
-
You must call TTF.init first when you use True Type Font.
|
1745
|
-
|
1746
|
-
--- SDL::TTF.open(filename,size,index=0)
|
1747
|
-
Open a font file and create a font of the specified point size.
|
1748
|
-
|
1749
|
-
And you can specify font face with index. Need SDL_ttf 2.0.4 or
|
1750
|
-
later to use this feature.
|
1751
|
-
|
1752
|
-
==== method
|
1753
|
-
|
1754
|
-
--- SDL::TTF#style
|
1755
|
-
Returns the font style.
|
1756
|
-
|
1757
|
-
--- SDL::TTF#style=(style)
|
1758
|
-
Set font style.
|
1759
|
-
style is an OR'd conbination of one or more of the following
|
1760
|
-
SDL::TTF::STYLE_NORMAL
|
1761
|
-
SDL::TTF::STYLE_BOLD
|
1762
|
-
SDL::TTF::STYLE_ITALIC
|
1763
|
-
SDL::TTF::STYLE_UNDERLINE
|
1764
|
-
|
1765
|
-
--- SDL::TTF#textSize(text)
|
1766
|
-
--- SDL::TTF#text_size(text)
|
1767
|
-
Get Text size on image in array. Return [width,height].
|
1768
|
-
|
1769
|
-
--- SDL::TTF#faces
|
1770
|
-
Need SDL_ttf 2.0.4 or later
|
1771
|
-
Returns the number of face.
|
1772
|
-
|
1773
|
-
--- SDL::TTF#fixedWidth?
|
1774
|
-
--- SDL::TTF#fixed_width?
|
1775
|
-
Need SDL_ttf 2.0.4 or later.
|
1776
|
-
Returns whether this font has fixed width or not.
|
1777
|
-
|
1778
|
-
--- SDL::TTF#familyName
|
1779
|
-
--- SDL::TTF#family_name
|
1780
|
-
Need SDL_ttf 2.0.4 or later
|
1781
|
-
Returns the name of font family.
|
1782
|
-
|
1783
|
-
--- SDL::TTF#styleName
|
1784
|
-
--- SDL::TTF#style_name
|
1785
|
-
Need SDL_ttf 2.0.4 or later
|
1786
|
-
Returns the name of style.
|
1787
|
-
|
1788
|
-
--- SDL::TTF#height
|
1789
|
-
Get the total height of the font - usually equal to point size.
|
1790
|
-
|
1791
|
-
--- SDL::TTF#ascent
|
1792
|
-
Get the offset from the baseline to the top of the font
|
1793
|
-
This is a positive value, relative to the baseline.
|
1794
|
-
|
1795
|
-
--- SDL::TTF#descent
|
1796
|
-
Get the offset from the baseline to the bottom of the font
|
1797
|
-
This is a negative value, relative to the baseline.
|
1798
|
-
|
1799
|
-
--- SDL::TTF#lineSkip
|
1800
|
-
--- SDL::TTF#line_skip
|
1801
|
-
Get the recommended spacing between lines of text for this font.
|
1802
|
-
|
1803
|
-
--- SDL::TTF#drawSolidUTF8(dest,text,x,y,r,g,b)
|
1804
|
-
--- SDL::TTF#draw_solid_utf8(dest,text,x,y,r,g,b)
|
1805
|
-
Draw text on "dest" at ("x","y"). r,g,b are color elements of text.
|
1806
|
-
This function use colorkey internally.
|
1807
|
-
Text must be UTF-8 (you can use ASCII code).
|
1808
|
-
|
1809
|
-
--- SDL::TTF#drawBlendedUTF8(dest,text,x,y,r,g,b)
|
1810
|
-
--- SDL::TTF#draw_blended_utf8(dest,text,x,y,r,g,b)
|
1811
|
-
Similar to drawSolidUTF8.
|
1812
|
-
More beautiful than drawSolidUTF8,but more slowly than drawSolidUTF8.
|
1813
|
-
|
1814
|
-
--- SDL::TTF#drawShadedUTF8(dest,text,x,y,fg_r,fg_g,fg_b,bg_r,bg_g,bg_b)
|
1815
|
-
--- SDL::TTF#draw_shaded_utf8(dest,text,x,y,fg_r,fg_g,fg_b,bg_r,bg_g,bg_b)
|
1816
|
-
Similar to drawSolidUTF8.
|
1817
|
-
This method is defferent from drawSolidUTF8 in that this method
|
1818
|
-
fills the background of text with specified color.
|
1819
|
-
|
1820
|
-
--- SDL::TTF#renderSolidUTF8(text,r,g,b)
|
1821
|
-
--- SDL::TTF#render_solid_utf8(text,r,g,b)
|
1822
|
-
Draws text on the new surface and returns it.
|
1823
|
-
If this method fails to render, you'll get nil.
|
1824
|
-
This method draws text like drawSolidUTF8.
|
1825
|
-
|
1826
|
-
--- SDL::TTF#renderBlendedUTF8(text,r,g,b)
|
1827
|
-
--- SDL::TTF#render_blended_utf8(text,r,g,b)
|
1828
|
-
Same as ((<SDL::TTF#renderSolidUTF8>)), but this method draws
|
1829
|
-
like ((<SDL::TTF#drawBlendedUTF8>)).
|
1830
|
-
|
1831
|
-
--- SDL::TTF#renderShadedUTF8(text,fg_r,fg_g,fg_b,bg_r,bg_g,bg_b)
|
1832
|
-
--- SDL::TTF#render_shaded_utf8(text,fg_r,fg_g,fg_b,bg_r,bg_g,bg_b)
|
1833
|
-
Same as ((<SDL::TTF#renderSolidUTF8>)), but this method draws
|
1834
|
-
like ((<SDL::TTF#drawShadedUTF8>)).
|
1835
|
-
|
1836
|
-
== MPEG stream
|
1837
|
-
|
1838
|
-
Needs SMPEG library.
|
1839
|
-
|
1840
|
-
If you will play mpeg with sound, you should call ((<SDL.init>)) with
|
1841
|
-
SDL::INIT_AUDIO, and call ((<SDL::Mixer.open>)).
|
1842
|
-
|
1843
|
-
Don't touch the destination surface while playing mpeg, because smpeg uses
|
1844
|
-
native thread.
|
1845
|
-
|
1846
|
-
Don't play sound with ((<SDL::Mixer>)) when playing mpeg, because smpeg
|
1847
|
-
hooks SDL_Mixer's playback functions.
|
1848
|
-
|
1849
|
-
=== SDL::MPEG
|
1850
|
-
|
1851
|
-
This class handles MPEG stream
|
1852
|
-
|
1853
|
-
==== super class
|
1854
|
-
|
1855
|
-
Object
|
1856
|
-
|
1857
|
-
==== class method
|
1858
|
-
|
1859
|
-
--- SDL::MPEG.load(filename)
|
1860
|
-
--- SDL::MPEG.new(filename)
|
1861
|
-
Create a new SDL::MPEG object from an MPEG file.
|
1862
|
-
|
1863
|
-
==== ��å�
|
1864
|
-
|
1865
|
-
--- SDL::MPEG#info
|
1866
|
-
Returns the current information of SDL::MPEG instance.
|
1867
|
-
Return value is a instance of ((<SDL::MPEG::Info>))
|
1868
|
-
|
1869
|
-
--- SDL::MPEG#enableAudio(enable)
|
1870
|
-
--- SDL::MPEG#enable_audio(enable)
|
1871
|
-
Enable or disable audio playback in MPEG stream.
|
1872
|
-
|
1873
|
-
--- SDL::MPEG#enableVideo(enable)
|
1874
|
-
--- SDL::MPEG#enable_video(enable)
|
1875
|
-
Enable or disable video playback in MPEG stream.
|
1876
|
-
|
1877
|
-
--- SDL::MPEG#status
|
1878
|
-
Returns the current status.Returns following value.
|
1879
|
-
SDL::MPEG::ERROR
|
1880
|
-
SDL::MPEG::STOPPED
|
1881
|
-
SDL::MPEG::PLAYING
|
1882
|
-
|
1883
|
-
--- SDL::MPEG#setVolume(volume)
|
1884
|
-
--- SDL::MPEG#set_volume(volume)
|
1885
|
-
Set the audio volume of an MPEG stream, in the range 0-100.
|
1886
|
-
|
1887
|
-
--- SDL::MPEG#setDisplay(surface)
|
1888
|
-
--- SDL::MPEG#set_display(surface)
|
1889
|
-
Set the destination surface for MPEG video playback.
|
1890
|
-
|
1891
|
-
--- SDL::MPEG#setLoop(repeat)
|
1892
|
-
--- SDL::MPEG#set_loop(repeat)
|
1893
|
-
Set or clear looping play.
|
1894
|
-
|
1895
|
-
--- SDL::MPEG#scaleXY(w,h)
|
1896
|
-
--- SDL::MPEG#scale_xy(w,h)
|
1897
|
-
Scale pixel display.
|
1898
|
-
|
1899
|
-
--- SDL::MPEG#scale(scale)
|
1900
|
-
Scale pixel display.
|
1901
|
-
|
1902
|
-
--- SDL::MPEG#move(x,y)
|
1903
|
-
Move the video display area within the destination surface.
|
1904
|
-
|
1905
|
-
--- SDL::MPEG#setDisplayRegion(x,y,w,h)
|
1906
|
-
--- SDL::MPEG#set_display_region(x,y,w,h)
|
1907
|
-
Set the region of the video to be shown.
|
1908
|
-
|
1909
|
-
--- SDL::MPEG#play
|
1910
|
-
Play an MPEG stream.
|
1911
|
-
|
1912
|
-
Warning: Don't access the surface while playing.
|
1913
|
-
|
1914
|
-
--- SDL::MPEG#pause
|
1915
|
-
Pause/Resume playback.
|
1916
|
-
|
1917
|
-
--- SDL::MPEG#stop
|
1918
|
-
Stop playback.
|
1919
|
-
|
1920
|
-
--- SDL::MPEG#rewind
|
1921
|
-
Rewind the play position of MPEG stream to the begining of the MPEG.
|
1922
|
-
|
1923
|
-
--- SDL::MPEG#seek(bytes)
|
1924
|
-
Seek 'bytes' bytes in the MPEG stream.
|
1925
|
-
|
1926
|
-
--- SDL::MPEG#skip(seconds)
|
1927
|
-
Skip 'seconds' seconds in the MPEG stream.
|
1928
|
-
|
1929
|
-
--- SDL::MPEG#renderFrame(framenum)
|
1930
|
-
--- SDL::MPEG#render_frame(framenum)
|
1931
|
-
Render a particular frame in the MPEG video.
|
1932
|
-
|
1933
|
-
--- SDL::MPEG#setFilter(filter)
|
1934
|
-
--- SDL::MPEG#set_filter(filter)
|
1935
|
-
Set video filter. Available filter is following.
|
1936
|
-
SDL::MPEG::NULL_FILTER No filter
|
1937
|
-
SDL::MPEG::BILINEAR_FILTER Bilinear filter
|
1938
|
-
SDL::MPEG::DEBLOCKING_FILTER Deblocking filter
|
1939
|
-
|
1940
|
-
=== SDL::MPEG::Info
|
1941
|
-
|
1942
|
-
The instance of this class has the information of ((<SDL::MPEG>)).
|
1943
|
-
Get that with ((<SDL::MPEG#info>)).
|
1944
|
-
|
1945
|
-
==== super class
|
1946
|
-
|
1947
|
-
Object
|
1948
|
-
|
1949
|
-
==== method
|
1950
|
-
|
1951
|
-
--- SDL::MPEG::Info#has_audio
|
1952
|
-
--- SDL::MPEG::Info#has_video
|
1953
|
-
--- SDL::MPEG::Info#width
|
1954
|
-
--- SDL::MPEG::Info#height
|
1955
|
-
--- SDL::MPEG::Info#current_frame
|
1956
|
-
--- SDL::MPEG::Info#current_fps
|
1957
|
-
--- SDL::MPEG::Info#audio_string
|
1958
|
-
--- SDL::MPEG::Info#audio_current_frame
|
1959
|
-
--- SDL::MPEG::Info#current_offset
|
1960
|
-
--- SDL::MPEG::Info#total_size
|
1961
|
-
--- SDL::MPEG::Info#current_time
|
1962
|
-
--- SDL::MPEG::Info#total_time
|
1963
|
-
|
1964
|
-
== Time
|
1965
|
-
|
1966
|
-
=== module function
|
1967
|
-
|
1968
|
-
--- SDL.getTicks
|
1969
|
-
--- SDL.get_ticks
|
1970
|
-
Get the number of milliseconds since the SDL library initialization.
|
1971
|
-
Note that this value wraps if the program runs for more than ~49 days.
|
1972
|
-
|
1973
|
-
--- SDL.delay(ms)
|
1974
|
-
Wait a specified number of milliseconds before returning. this
|
1975
|
-
function will wait at least the specified time, but possible
|
1976
|
-
longer due to OS scheduling.
|
1977
|
-
|
1978
|
-
== Japanese input method with SDLSKK
|
1979
|
-
|
1980
|
-
Needs SDLSKK library.
|
1981
|
-
|
1982
|
-
You need calling ((<SDL::Event2.enableUNICODE>)) after calling ((<SDL.init>))
|
1983
|
-
to use SDLSKK.
|
1984
|
-
|
1985
|
-
=== module function
|
1986
|
-
|
1987
|
-
--- SDL::SKK.encoding=(encoding)
|
1988
|
-
Set encoding of SDLSKK.
|
1989
|
-
* SDL::SKK::EUCJP
|
1990
|
-
* SDL::SKK::UTF8
|
1991
|
-
* SDL::SKK::SJIS
|
1992
|
-
|
1993
|
-
--- SDL::SKK.encoding
|
1994
|
-
Return encoding.
|
1995
|
-
|
1996
|
-
=== SDL::SKK::Context
|
1997
|
-
|
1998
|
-
This class represents the state of input.
|
1999
|
-
|
2000
|
-
==== super class
|
2001
|
-
|
2002
|
-
Object
|
2003
|
-
|
2004
|
-
==== class method
|
2005
|
-
|
2006
|
-
--- SDL::SKK::Context.new(dict,romkana_table,keybind,use_minibuffer)
|
2007
|
-
Create an instance of ((<SDL::SKK::Context>)) from the dictionary,
|
2008
|
-
the keybind and the RomKanaRuleTable. And if use_minibuffer is true, you
|
2009
|
-
can use minibuffer.
|
2010
|
-
|
2011
|
-
==== method
|
2012
|
-
|
2013
|
-
--- SDL::SKK::Context#input(event)
|
2014
|
-
Inputs from keyboard thorough event object.
|
2015
|
-
|
2016
|
-
--- SDL::SKK::Context#str
|
2017
|
-
Returns input (Japanese) string.
|
2018
|
-
|
2019
|
-
--- SDL::SKK::Context#render_str(font,r,g,b)
|
2020
|
-
Renders the text.
|
2021
|
-
|
2022
|
-
--- SDL::SKK::Context#render_minibuffer_str(font,r,g,b)
|
2023
|
-
Renders minibuffer text.
|
2024
|
-
|
2025
|
-
--- SDL::SKK::Context#clear
|
2026
|
-
Clears text and initializes context.
|
2027
|
-
|
2028
|
-
--- SDL::SKK::Context#get_basic_mode
|
2029
|
-
Returns whether context's state is basic mode.
|
2030
|
-
|
2031
|
-
If this method returns true, and you get return, you can
|
2032
|
-
stop inputting.
|
2033
|
-
|
2034
|
-
|
2035
|
-
=== SDL::SKK::Dictionary
|
2036
|
-
|
2037
|
-
==== super class
|
2038
|
-
|
2039
|
-
Object
|
2040
|
-
|
2041
|
-
==== class method
|
2042
|
-
|
2043
|
-
--- SDL::SKK::Dictionary.new
|
2044
|
-
Creates the instance of ((<SDL::SKK::Dictionary>)).
|
2045
|
-
The content of that is empty just after creating.
|
2046
|
-
|
2047
|
-
==== method
|
2048
|
-
|
2049
|
-
--- SDL::SKK::Dictionary#load(dictfile,users)
|
2050
|
-
Load dictionary from file.
|
2051
|
-
If users is true, then this method regards it as user's dictionary.
|
2052
|
-
|
2053
|
-
--- SDL::SKK::Dictionary#save(filename)
|
2054
|
-
Save user's dictionary.
|
2055
|
-
|
2056
|
-
=== SDL::SKK::RomKanaRuleTable
|
2057
|
-
|
2058
|
-
This class represents the rule of conversion from Alphabet to Japanese kana.
|
2059
|
-
|
2060
|
-
==== super class
|
2061
|
-
|
2062
|
-
Object
|
2063
|
-
|
2064
|
-
==== class method
|
2065
|
-
|
2066
|
-
--- SDL::SKK::RomKanaRuleTable.new(table_file)
|
2067
|
-
Create the instance of ((<SDL::SKK::RomKanaRuleTable>)) from rule file.
|
2068
|
-
|
2069
|
-
==== method
|
2070
|
-
|
2071
|
-
=== SDL::SKK::Keybind
|
2072
|
-
|
2073
|
-
This class represents the keybind in SDLSKK input system.
|
2074
|
-
|
2075
|
-
==== super class
|
2076
|
-
|
2077
|
-
Object
|
2078
|
-
|
2079
|
-
==== class method
|
2080
|
-
|
2081
|
-
--- SDL::SKK::Keybind.new
|
2082
|
-
Create the instance of ((<SDL::SKK::Keybind>)) without any keybind.
|
2083
|
-
|
2084
|
-
==== method
|
2085
|
-
|
2086
|
-
--- SDL::SKK::Keybind#set_key(key_str,cmd_str)
|
2087
|
-
Set keybind.
|
2088
|
-
|
2089
|
-
You can use following string as ((|key_str|)).
|
2090
|
-
* alphabet and other ascii character
|
2091
|
-
* "SPC" "TAB" "DEL" "RET" "UP" "DOWN" "RIGHT" "LEFT" "INSERT" "HOME" "END"
|
2092
|
-
"PAGEUP" "PAGEDOWN" "F1" "F2" "F3" "F4" "F5" "F6" "F7" "F8" "F9" "F10"
|
2093
|
-
"F11" "F12" "F13" "F14" "F15" "HELP"
|
2094
|
-
* Modified key like "C-a" or "M-C-a"
|
2095
|
-
|
2096
|
-
And you can following as ((|cmd_str|))
|
2097
|
-
* "backward-char",
|
2098
|
-
* "forward-char",
|
2099
|
-
* "backward-delete-char",
|
2100
|
-
* "delete-char",
|
2101
|
-
* "kakutei",
|
2102
|
-
* "kettei",
|
2103
|
-
* "space",
|
2104
|
-
* "keyboard-quit",
|
2105
|
-
* "set-mark-command",
|
2106
|
-
* "kill-region",
|
2107
|
-
* "yank",
|
2108
|
-
* "copy",
|
2109
|
-
* "graph-char",
|
2110
|
-
* "upper-char",
|
2111
|
-
* "lower-char",
|
2112
|
-
* "abbrev-input",
|
2113
|
-
* "latin-mode",
|
2114
|
-
* "previous-candidate",
|
2115
|
-
* "jisx0208-mode",
|
2116
|
-
* "toggle-kana",
|
2117
|
-
* "beginning-of-line"
|
2118
|
-
* "end-of-line"
|
2119
|
-
* "do-nothing"
|
2120
|
-
|
2121
|
-
You should not set any command on one ascii character like "a" or "/".
|
2122
|
-
|
2123
|
-
--- SDL::SKK::Keybind#set_default_key
|
2124
|
-
Set default keybind. You should call this method immediately after
|
2125
|
-
call ((<SDL::SKK::Keybind.new>))
|
2126
|
-
|
2127
|
-
--- SDL::SKK::Keybind#unset_key(key_str)
|
2128
|
-
Unset keybind.
|
2129
|
-
|
2130
|
-
== 3D drawing with OpenGL
|
2131
|
-
You can draw 3D graphics with OpenGL.
|
2132
|
-
|
2133
|
-
How to use OpenGL.
|
2134
|
-
(1) require 'sdl'; require 'opengl'
|
2135
|
-
(2) Call ((<SDL.init>)) with SDL::INIT_VIDEO
|
2136
|
-
(3) Set attribute of OpenGL, please use ((<SDL.setGLAttr>))
|
2137
|
-
(4) Call ((<SDL.setVideoMode>)) with SDL::OPENGL
|
2138
|
-
(5) Use GL module methods to draw
|
2139
|
-
(6) Call ((<SDL.GLSwapBuffersn>)) instead of ((<SDL.flip>)) to update screen
|
2140
|
-
|
2141
|
-
Please see sample/opengl.rb .
|
2142
|
-
|
2143
|
-
=== module function
|
2144
|
-
--- SDL.setGLAttr(attr,val)
|
2145
|
-
--- SDL.set_GL_attr(attr,val)
|
2146
|
-
Set the value of special SDL/OpenGL attribute.
|
2147
|
-
|
2148
|
-
List of attribute:
|
2149
|
-
* SDL::GL_RED_SIZE
|
2150
|
-
* SDL::GL_GREEN_SIZE
|
2151
|
-
* SDL::GL_BLUE_SIZE
|
2152
|
-
* SDL::GL_ALPHA_SIZE
|
2153
|
-
* SDL::GL_BUFFER_SIZE
|
2154
|
-
* SDL::GL_DOUBLEBUFFER
|
2155
|
-
* SDL::GL_DEPTH_SIZE
|
2156
|
-
* SDL::GL_STENCIL_SIZE
|
2157
|
-
* SDL::GL_ACCUM_RED_SIZE
|
2158
|
-
* SDL::GL_ACCUM_GREEN_SIZE
|
2159
|
-
* SDL::GL_ACCUM_BLUE_SIZE
|
2160
|
-
* SDL::GL_ACCUM_ALPHA_SIZE
|
2161
|
-
|
2162
|
-
--- SDL.getGLAttr(attr)
|
2163
|
-
--- SDL.get_GL_attr(attr)
|
2164
|
-
Get the value of special SDL/OpenGL attribute.
|
2165
|
-
|
2166
|
-
--- SDL.GLSwapBuffers
|
2167
|
-
--- SDL.GL_swap_buffers
|
2168
|
-
Swap the OpenGL buffers, update display, if double-buffering is supported.
|
2169
|
-
|
2170
|
-
== Others
|
2171
|
-
=== Avoid pthread problem
|
2172
|
-
You can possibly avoid Ruby/SDL pthread problem when you put following
|
2173
|
-
in your script.
|
2174
|
-
require 'rbconfig'
|
2175
|
-
|
2176
|
-
if RUBY_PLATFORM =~ /linux/
|
2177
|
-
trap('INT','EXIT')
|
2178
|
-
trap('EXIT','EXIT')
|
2179
|
-
end
|
2180
|
-
|
2181
|
-
=end
|