rubysdl 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +505 -0
- data/MANIFEST +81 -0
- data/NEWS.en +144 -0
- data/NEWS.ja +151 -0
- data/README.en +117 -0
- data/README.ja +166 -0
- data/SDL_kanji.c +403 -0
- data/SDL_kanji.h +48 -0
- data/depend +18 -0
- data/doc/Makefile +18 -0
- data/doc/cdrom.rsd +431 -0
- data/doc/collision.rsd +162 -0
- data/doc/event.rsd +1487 -0
- data/doc/font.rsd +839 -0
- data/doc/general.rsd +49 -0
- data/doc/init.rsd +175 -0
- data/doc/joystick.rsd +387 -0
- data/doc/mixer.rsd +837 -0
- data/doc/mpeg.rsd +595 -0
- data/doc/rsd.rb +125 -0
- data/doc/sdlskk.rsd +496 -0
- data/doc/time.rsd +45 -0
- data/doc/video.rsd +2499 -0
- data/doc/wm.rsd +113 -0
- data/extconf.rb +92 -0
- data/lib/rubysdl_aliases.rb +431 -0
- data/lib/sdl.rb +271 -0
- data/rubysdl.h +109 -0
- data/rubysdl_cdrom.c +176 -0
- data/rubysdl_const_list.txt +280 -0
- data/rubysdl_doc.en.rd +2180 -0
- data/rubysdl_doc_old.rd +2402 -0
- data/rubysdl_event.c +346 -0
- data/rubysdl_event2.c +417 -0
- data/rubysdl_event_key.c +356 -0
- data/rubysdl_image.c +53 -0
- data/rubysdl_joystick.c +156 -0
- data/rubysdl_kanji.c +135 -0
- data/rubysdl_main.c +202 -0
- data/rubysdl_mixer.c +422 -0
- data/rubysdl_mouse.c +96 -0
- data/rubysdl_opengl.c +63 -0
- data/rubysdl_pixel.c +133 -0
- data/rubysdl_ref.html +5550 -0
- data/rubysdl_ref.rd +6163 -0
- data/rubysdl_rwops.c +90 -0
- data/rubysdl_sdlskk.c +312 -0
- data/rubysdl_sge_video.c +622 -0
- data/rubysdl_smpeg.c +341 -0
- data/rubysdl_time.c +36 -0
- data/rubysdl_ttf.c +324 -0
- data/rubysdl_video.c +749 -0
- data/rubysdl_wm.c +71 -0
- data/sample/aadraw.rb +24 -0
- data/sample/alpha.rb +27 -0
- data/sample/alphadraw.rb +25 -0
- data/sample/bfont.rb +24 -0
- data/sample/cdrom.rb +17 -0
- data/sample/collision.rb +97 -0
- data/sample/cursor.bmp +0 -0
- data/sample/cursor.rb +22 -0
- data/sample/ellipses.rb +35 -0
- data/sample/event2.rb +32 -0
- data/sample/font.bmp +0 -0
- data/sample/font.rb +25 -0
- data/sample/fpstimer.rb +175 -0
- data/sample/icon.bmp +0 -0
- data/sample/joy2.rb +81 -0
- data/sample/kanji.rb +36 -0
- data/sample/movesp.rb +93 -0
- data/sample/playmod.rb +14 -0
- data/sample/plaympeg.rb +48 -0
- data/sample/playwave.rb +16 -0
- data/sample/randrect.rb +40 -0
- data/sample/sample.ttf +0 -0
- data/sample/sdlskk.rb +70 -0
- data/sample/sgetest.rb +31 -0
- data/sample/stetris.rb +275 -0
- data/sample/testgl.rb +166 -0
- data/sample/testsprite.rb +68 -0
- data/sample/transformblit.rb +41 -0
- metadata +121 -0
@@ -0,0 +1,280 @@
|
|
1
|
+
SDL::
|
2
|
+
INIT_TIMER
|
3
|
+
INIT_AUDIO
|
4
|
+
INIT_VIDEO
|
5
|
+
INIT_CDROM
|
6
|
+
INIT_JOYSTICK
|
7
|
+
INIT_NOPARACHUTE
|
8
|
+
INIT_EVENTTHREAD
|
9
|
+
INIT_EVERYTHING
|
10
|
+
|
11
|
+
SWSURFACE
|
12
|
+
HWSURFACW
|
13
|
+
ASYNCBLIT
|
14
|
+
ANYFORMAT
|
15
|
+
HWPALETTE
|
16
|
+
DOUBLEBUF
|
17
|
+
FULLSCREEN
|
18
|
+
OPENGL
|
19
|
+
OPENGLBLIT
|
20
|
+
RESIZABLE
|
21
|
+
HWACCEL
|
22
|
+
SRCCOLORKEY
|
23
|
+
RLEACCELOK
|
24
|
+
RLEACCEL
|
25
|
+
SRCALPHA
|
26
|
+
PREALLOC
|
27
|
+
|
28
|
+
ALPHA_OPAQUE
|
29
|
+
ALPHA_TRANSPARENT
|
30
|
+
|
31
|
+
TRANSFORM_AA
|
32
|
+
TRANSFORM_SAFE
|
33
|
+
TRANSFORM_TMAP
|
34
|
+
|
35
|
+
SDL::Event::
|
36
|
+
NOEVENT
|
37
|
+
ACTIVEEVENT
|
38
|
+
KEYDOWN
|
39
|
+
KEYUP
|
40
|
+
MOUSEMOTION
|
41
|
+
MOUSEBUTTONDOWN
|
42
|
+
MOUSEBUTTONUP
|
43
|
+
JOYAXISMOTION
|
44
|
+
JOYBALLMOTION
|
45
|
+
JOYHATMOTION
|
46
|
+
JOYBUTTONDOWN
|
47
|
+
JOYBUTTONUP
|
48
|
+
QUIT
|
49
|
+
SYSWMEVENT
|
50
|
+
EVENT_RESERVEDA
|
51
|
+
EVENT_RESERVEDB
|
52
|
+
VIDEORESIZE
|
53
|
+
EVENT_RESERVED1
|
54
|
+
EVENT_RESERVED2
|
55
|
+
EVENT_RESERVED3
|
56
|
+
EVENT_RESERVED4
|
57
|
+
EVENT_RESERVED5
|
58
|
+
EVENT_RESERVED6
|
59
|
+
EVENT_RESERVED7
|
60
|
+
USEREVENT
|
61
|
+
NUMEVENTS
|
62
|
+
APPMOUSEFOCUS
|
63
|
+
APPINPUTFOCUS
|
64
|
+
APPACTIVE
|
65
|
+
|
66
|
+
SDL::Mouse::
|
67
|
+
BUTTON_LEFT
|
68
|
+
BUTTON_MIDDLE
|
69
|
+
BUTTON_RIGHT
|
70
|
+
|
71
|
+
SDL::Key::
|
72
|
+
UNKNOWN
|
73
|
+
FIRST
|
74
|
+
BACKSPACE
|
75
|
+
TAB
|
76
|
+
CLEAR
|
77
|
+
RETURN
|
78
|
+
PAUSE
|
79
|
+
ESCAPE
|
80
|
+
SPACE
|
81
|
+
EXCLAIM
|
82
|
+
QUOTEDBL
|
83
|
+
HASH
|
84
|
+
DOLLAR
|
85
|
+
AMPERSAND
|
86
|
+
QUOTE
|
87
|
+
LEFTPAREN
|
88
|
+
RIGHTPAREN
|
89
|
+
ASTERISK
|
90
|
+
PLUS
|
91
|
+
COMMA
|
92
|
+
MINUS
|
93
|
+
PERIOD
|
94
|
+
SLASH
|
95
|
+
K0
|
96
|
+
K1
|
97
|
+
K2
|
98
|
+
K3
|
99
|
+
K4
|
100
|
+
K5
|
101
|
+
K6
|
102
|
+
K7
|
103
|
+
K8
|
104
|
+
K9
|
105
|
+
COLON
|
106
|
+
SEMICOLON
|
107
|
+
LESS
|
108
|
+
EQUALS
|
109
|
+
GREATER
|
110
|
+
QUESTION
|
111
|
+
AT
|
112
|
+
LEFTBRACKET
|
113
|
+
BACKSLASH
|
114
|
+
RIGHTBRACKET
|
115
|
+
CARET
|
116
|
+
UNDERSCORE
|
117
|
+
BACKQUOTE
|
118
|
+
A
|
119
|
+
B
|
120
|
+
C
|
121
|
+
D
|
122
|
+
E
|
123
|
+
F
|
124
|
+
G
|
125
|
+
H
|
126
|
+
I
|
127
|
+
J
|
128
|
+
K
|
129
|
+
L
|
130
|
+
M
|
131
|
+
N
|
132
|
+
O
|
133
|
+
P
|
134
|
+
Q
|
135
|
+
R
|
136
|
+
S
|
137
|
+
T
|
138
|
+
U
|
139
|
+
V
|
140
|
+
W
|
141
|
+
X
|
142
|
+
Y
|
143
|
+
Z
|
144
|
+
DELETE
|
145
|
+
KP0
|
146
|
+
KP1
|
147
|
+
KP2
|
148
|
+
KP3
|
149
|
+
KP4
|
150
|
+
KP5
|
151
|
+
KP6
|
152
|
+
KP7
|
153
|
+
KP8
|
154
|
+
KP9
|
155
|
+
KP_PERIOD
|
156
|
+
KP_DIVIDE
|
157
|
+
KP_MULTIPLY
|
158
|
+
KP_MINUS
|
159
|
+
KP_PLUS
|
160
|
+
KP_ENTER
|
161
|
+
KP_EQUALS
|
162
|
+
UP
|
163
|
+
DOWN
|
164
|
+
RIGHT
|
165
|
+
LEFT
|
166
|
+
INSERT
|
167
|
+
HOME
|
168
|
+
END
|
169
|
+
PAGEUP
|
170
|
+
PAGEDOWN
|
171
|
+
F1
|
172
|
+
F2
|
173
|
+
F3
|
174
|
+
F4
|
175
|
+
F5
|
176
|
+
F6
|
177
|
+
F7
|
178
|
+
F8
|
179
|
+
F9
|
180
|
+
F10
|
181
|
+
F11
|
182
|
+
F12
|
183
|
+
F13
|
184
|
+
F14
|
185
|
+
F15
|
186
|
+
NUMLOCK
|
187
|
+
CAPSLOCK
|
188
|
+
SCROLLOCK
|
189
|
+
RSHIFT
|
190
|
+
LSHIFT
|
191
|
+
RCTRL
|
192
|
+
LCTRL
|
193
|
+
RALT
|
194
|
+
LALT
|
195
|
+
RMETA
|
196
|
+
LMETA
|
197
|
+
LSUPER
|
198
|
+
RSUPER
|
199
|
+
MODE
|
200
|
+
HELP
|
201
|
+
PRINT
|
202
|
+
SYSREQ
|
203
|
+
BREAK
|
204
|
+
MENU
|
205
|
+
POWER
|
206
|
+
EURO
|
207
|
+
LAST
|
208
|
+
|
209
|
+
MOD_NONE
|
210
|
+
MOD_LSHIFT
|
211
|
+
MOD_RSHIFT
|
212
|
+
MOD_LCTRL
|
213
|
+
MOD_RCTRL
|
214
|
+
MOD_LALT
|
215
|
+
MOD_RALT
|
216
|
+
MOD_LMETA
|
217
|
+
MOD_RMETA
|
218
|
+
MOD_NUM
|
219
|
+
MOD_CAPS
|
220
|
+
MOD_MODE
|
221
|
+
MOD_RESERVED
|
222
|
+
MOD_CTRL
|
223
|
+
MOD_SHIFT
|
224
|
+
MOD_ALT
|
225
|
+
MOD_META
|
226
|
+
|
227
|
+
SDL::Mixer::
|
228
|
+
FORMAT_U8
|
229
|
+
FORMAT_S8
|
230
|
+
FORMAT_U16LSB
|
231
|
+
FORMAT_S16LSB
|
232
|
+
FORMAT_U16MSB
|
233
|
+
FORMAT_S16MSB
|
234
|
+
FORMAT_U16
|
235
|
+
FORMAT_S16
|
236
|
+
FORMAT_U16SYS
|
237
|
+
FORMAT_S16SYS
|
238
|
+
|
239
|
+
CHANNELS
|
240
|
+
DEFAULT_FREQUENCY
|
241
|
+
DEFAULT_FORMAT
|
242
|
+
DEFAULT_CHANNELS
|
243
|
+
MAX_VOLUME
|
244
|
+
|
245
|
+
SDL::WM
|
246
|
+
|
247
|
+
SDL::CD
|
248
|
+
TRAYEMPTY
|
249
|
+
STOPPED
|
250
|
+
PLAYING
|
251
|
+
PAUSED
|
252
|
+
ERROR
|
253
|
+
|
254
|
+
AUDIO_TRACK
|
255
|
+
DATA_TRACK
|
256
|
+
|
257
|
+
SDL::JoyStick
|
258
|
+
HAT_CENTERED
|
259
|
+
HAT_UP
|
260
|
+
HAT_RIGHT
|
261
|
+
HAT_DOWN
|
262
|
+
HAT_LEFT
|
263
|
+
HAT_RIGHTUP
|
264
|
+
HAT_RIGHTDOWN
|
265
|
+
HAT_LEFTUP
|
266
|
+
HAT_LEFTDOWN
|
267
|
+
|
268
|
+
SDL::TTF
|
269
|
+
STYLE_NORMAL
|
270
|
+
STYLE_BOLD
|
271
|
+
STYLE_ITALIC
|
272
|
+
STYLE_UNDERLINE
|
273
|
+
|
274
|
+
SDL::MPEG::
|
275
|
+
ERROR
|
276
|
+
STOPPED
|
277
|
+
PLAYING
|
278
|
+
NULL_FULTER
|
279
|
+
BILINEAR_FILTER
|
280
|
+
DEBLOCKING_FILTER
|
data/rubysdl_doc.en.rd
ADDED
@@ -0,0 +1,2180 @@
|
|
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 Joystick.updateAll is called automatically.
|
1576
|
+
|
1577
|
+
--- SDL::JoyStick.pall=(polling)
|
1578
|
+
Set whether 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
|
+
Updates the state(position, buttons, etc.) of all open joysticks.
|
1603
|
+
|
1604
|
+
=== method
|
1605
|
+
|
1606
|
+
--- SDL::Joystick#index
|
1607
|
+
Returns the index of self.
|
1608
|
+
|
1609
|
+
--- SDL::Joystick#numAxes
|
1610
|
+
--- SDL::Joystick#num_axes
|
1611
|
+
Return the number of axes available from a previously opened
|
1612
|
+
joystick.
|
1613
|
+
|
1614
|
+
--- SDL::Joystick#numBalls
|
1615
|
+
--- SDL::Joystick#num_balls
|
1616
|
+
Return the number of trackballs available.
|
1617
|
+
|
1618
|
+
--- SDL::Joystick#numButtons
|
1619
|
+
--- SDL::Joystick#num_buttons
|
1620
|
+
Returns the number of buttons available.
|
1621
|
+
|
1622
|
+
--- SDL::Joystick#axis(axis_index)
|
1623
|
+
Returns a 16-bit signed integer representing the current position of the
|
1624
|
+
axis.
|
1625
|
+
On most modern joysticks the X axis is usually represented by axis 0 and
|
1626
|
+
the Y axis by axis 1. The value returned by Joystick#axis is a
|
1627
|
+
signed integer (-32768 to 32768) representing the current position of
|
1628
|
+
the axis, it maybe necessary to impose certain tolerances on these
|
1629
|
+
values to account for jitter. It is worth noting that some joysticks use
|
1630
|
+
axes 2 and 3 for extra buttons.
|
1631
|
+
|
1632
|
+
--- SDL::Joystick#hat(hat_index)
|
1633
|
+
The current state is returned as a 8bit unsigned integer
|
1634
|
+
which is defined as an OR'd combination of one or more of the following
|
1635
|
+
SDL::Joystick::HAT_CENTERED
|
1636
|
+
SDL::Joystick::HAT_UP
|
1637
|
+
SDL::Joystick::HAT_RIGHT
|
1638
|
+
SDL::Joystick::HAT_DOWN
|
1639
|
+
SDL::Joystick::HAT_LEFT
|
1640
|
+
SDL::Joystick::HAT_RIGHTUP
|
1641
|
+
SDL::Joystick::HAT_RIGHTDOWN
|
1642
|
+
SDL::Joystick::HAT_LEFTUP
|
1643
|
+
SDL::Joystick::HAT_LEFTDOWN
|
1644
|
+
|
1645
|
+
--- SDL::Joystick#button(button_index)
|
1646
|
+
Returns the current state of the given button.
|
1647
|
+
Returns true if the button is pressed,otherwise 0.
|
1648
|
+
|
1649
|
+
--- SDL::Joystick#ball(ball_index)
|
1650
|
+
Returns the motion deltas in array, [ dx,dy ] .
|
1651
|
+
Trackballs can only return relative motion since the last call to
|
1652
|
+
Joystick#ball, these motion deltas a placed into dx and dy.
|
1653
|
+
|
1654
|
+
== Font handling
|
1655
|
+
|
1656
|
+
=== SDL::BMFont
|
1657
|
+
|
1658
|
+
The class handles BitMap Font. This needs SGE.
|
1659
|
+
|
1660
|
+
==== super class
|
1661
|
+
|
1662
|
+
Object
|
1663
|
+
|
1664
|
+
==== class method
|
1665
|
+
|
1666
|
+
--- SDL::BMFont.open(filename,flags)
|
1667
|
+
Open a font file and create a bitmap font object.
|
1668
|
+
* SDL::BMFont::TRANSPARENT
|
1669
|
+
Transparent(Should usually be set)
|
1670
|
+
* SDL::BMFont::NOCONVERT
|
1671
|
+
* SDL::BMFont::SFONT
|
1672
|
+
* SDL::BMFont::PALETTE
|
1673
|
+
|
1674
|
+
==== method
|
1675
|
+
--- SDL::BMFont#setColor(r,g,b)
|
1676
|
+
--- SDL::BMFont#set_color
|
1677
|
+
Changes the color of the font.
|
1678
|
+
This doesn't work on 'color font' or sfont.
|
1679
|
+
|
1680
|
+
--- SDL::BMFont#height
|
1681
|
+
Get the height of the font.
|
1682
|
+
|
1683
|
+
--- SDL::BMFont#width
|
1684
|
+
Get the width of the font.
|
1685
|
+
|
1686
|
+
--- SDL::BMFont#textout(surface,string,x,y)
|
1687
|
+
Render the given string on surface. (x,y) is the position
|
1688
|
+
of the left top corner.
|
1689
|
+
|
1690
|
+
=== SDL::Kanji
|
1691
|
+
This class handles bdf fonts. You can draw Japanese character with this
|
1692
|
+
class.
|
1693
|
+
|
1694
|
+
==== super class
|
1695
|
+
|
1696
|
+
Object
|
1697
|
+
|
1698
|
+
==== class method
|
1699
|
+
--- SDL::Kanji.open(filename,size)
|
1700
|
+
Open bdf font file and return font object.
|
1701
|
+
You should specify font size as ((|size|)).
|
1702
|
+
|
1703
|
+
==== method
|
1704
|
+
--- SDL::Kanji#add(filename)
|
1705
|
+
Open other bdf file and add lacked glyphs.
|
1706
|
+
|
1707
|
+
--- SDL::Kanji#setCodingSystem
|
1708
|
+
--- SDL::Kanji#set_coding_system
|
1709
|
+
Set Character coding system. You can use following.
|
1710
|
+
* SDL::Kanji::JIS
|
1711
|
+
* SDL::Kanji::SJIS
|
1712
|
+
* SDL::Kanji::EUC
|
1713
|
+
|
1714
|
+
Default is SDL::Kanji::EUC.
|
1715
|
+
|
1716
|
+
--- SDL::Kanji#textwidth(text)
|
1717
|
+
Return the width of text.
|
1718
|
+
|
1719
|
+
--- SDL::Kanji#width
|
1720
|
+
Return the width of one ascii character.
|
1721
|
+
|
1722
|
+
--- SDL::Kanji#height
|
1723
|
+
Return font height.
|
1724
|
+
|
1725
|
+
--- SDL::Kanji#put(surface,text,x,y,r,g,b)
|
1726
|
+
Draw text on surface at (x,y) whose color is (r,g,b).
|
1727
|
+
|
1728
|
+
--- SDL::Kanji#putTate(surface,text,x,y,r,g,b)
|
1729
|
+
--- SDL::Kanji#put_tate(surface,text,x,y,r,g,b)
|
1730
|
+
Draw Tategaki text.
|
1731
|
+
|
1732
|
+
=== SDL::TTF
|
1733
|
+
|
1734
|
+
The class handles True Type Font. This needs SDL_ttf.
|
1735
|
+
|
1736
|
+
==== super class
|
1737
|
+
|
1738
|
+
Object
|
1739
|
+
|
1740
|
+
==== class method
|
1741
|
+
|
1742
|
+
--- SDL::TTF.init
|
1743
|
+
You must call TTF.init first when you use True Type Font.
|
1744
|
+
|
1745
|
+
--- SDL::TTF.open(filename,size,index=0)
|
1746
|
+
Open a font file and create a font of the specified point size.
|
1747
|
+
|
1748
|
+
And you can specify font face with index. Need SDL_ttf 2.0.4 or
|
1749
|
+
later to use this feature.
|
1750
|
+
|
1751
|
+
==== method
|
1752
|
+
|
1753
|
+
--- SDL::TTF#style
|
1754
|
+
Returns the font style.
|
1755
|
+
|
1756
|
+
--- SDL::TTF#style=(style)
|
1757
|
+
Set font style.
|
1758
|
+
style is an OR'd conbination of one or more of the following
|
1759
|
+
SDL::TTF::STYLE_NORMAL
|
1760
|
+
SDL::TTF::STYLE_BOLD
|
1761
|
+
SDL::TTF::STYLE_ITALIC
|
1762
|
+
SDL::TTF::STYLE_UNDERLINE
|
1763
|
+
|
1764
|
+
--- SDL::TTF#textSize(text)
|
1765
|
+
--- SDL::TTF#text_size(text)
|
1766
|
+
Get Text size on image in array. Return [width,height].
|
1767
|
+
|
1768
|
+
--- SDL::TTF#faces
|
1769
|
+
Need SDL_ttf 2.0.4 or later
|
1770
|
+
Returns the number of face.
|
1771
|
+
|
1772
|
+
--- SDL::TTF#fixedWidth?
|
1773
|
+
--- SDL::TTF#fixed_width?
|
1774
|
+
Need SDL_ttf 2.0.4 or later.
|
1775
|
+
Returns whether this font has fixed width or not.
|
1776
|
+
|
1777
|
+
--- SDL::TTF#familyName
|
1778
|
+
--- SDL::TTF#family_name
|
1779
|
+
Need SDL_ttf 2.0.4 or later
|
1780
|
+
Returns the name of font family.
|
1781
|
+
|
1782
|
+
--- SDL::TTF#styleName
|
1783
|
+
--- SDL::TTF#style_name
|
1784
|
+
Need SDL_ttf 2.0.4 or later
|
1785
|
+
Returns the name of style.
|
1786
|
+
|
1787
|
+
--- SDL::TTF#height
|
1788
|
+
Get the total height of the font - usually equal to point size.
|
1789
|
+
|
1790
|
+
--- SDL::TTF#ascent
|
1791
|
+
Get the offset from the baseline to the top of the font
|
1792
|
+
This is a positive value, relative to the baseline.
|
1793
|
+
|
1794
|
+
--- SDL::TTF#descent
|
1795
|
+
Get the offset from the baseline to the bottom of the font
|
1796
|
+
This is a negative value, relative to the baseline.
|
1797
|
+
|
1798
|
+
--- SDL::TTF#lineSkip
|
1799
|
+
--- SDL::TTF#line_skip
|
1800
|
+
Get the recommended spacing between lines of text for this font.
|
1801
|
+
|
1802
|
+
--- SDL::TTF#drawSolidUTF8(dest,text,x,y,r,g,b)
|
1803
|
+
--- SDL::TTF#draw_solid_utf8(dest,text,x,y,r,g,b)
|
1804
|
+
Draw text on "dest" at ("x","y"). r,g,b are color elements of text.
|
1805
|
+
This function use colorkey internally.
|
1806
|
+
Text must be UTF-8 (you can use ASCII code).
|
1807
|
+
|
1808
|
+
--- SDL::TTF#drawBlendedUTF8(dest,text,x,y,r,g,b)
|
1809
|
+
--- SDL::TTF#draw_blended_utf8(dest,text,x,y,r,g,b)
|
1810
|
+
Similar to drawSolidUTF8.
|
1811
|
+
More beautiful than drawSolidUTF8,but more slowly than drawSolidUTF8.
|
1812
|
+
|
1813
|
+
--- SDL::TTF#drawShadedUTF8(dest,text,x,y,fg_r,fg_g,fg_b,bg_r,bg_g,bg_b)
|
1814
|
+
--- SDL::TTF#draw_shaded_utf8(dest,text,x,y,fg_r,fg_g,fg_b,bg_r,bg_g,bg_b)
|
1815
|
+
Similar to drawSolidUTF8.
|
1816
|
+
This method is defferent from drawSolidUTF8 in that this method
|
1817
|
+
fills the background of text with specified color.
|
1818
|
+
|
1819
|
+
--- SDL::TTF#renderSolidUTF8(text,r,g,b)
|
1820
|
+
--- SDL::TTF#render_solid_utf8(text,r,g,b)
|
1821
|
+
Draws text on the new surface and returns it.
|
1822
|
+
If this method fails to render, you'll get nil.
|
1823
|
+
This method draws text like drawSolidUTF8.
|
1824
|
+
|
1825
|
+
--- SDL::TTF#renderBlendedUTF8(text,r,g,b)
|
1826
|
+
--- SDL::TTF#render_blended_utf8(text,r,g,b)
|
1827
|
+
Same as ((<SDL::TTF#renderSolidUTF8>)), but this method draws
|
1828
|
+
like ((<SDL::TTF#drawBlendedUTF8>)).
|
1829
|
+
|
1830
|
+
--- SDL::TTF#renderShadedUTF8(text,fg_r,fg_g,fg_b,bg_r,bg_g,bg_b)
|
1831
|
+
--- SDL::TTF#render_shaded_utf8(text,fg_r,fg_g,fg_b,bg_r,bg_g,bg_b)
|
1832
|
+
Same as ((<SDL::TTF#renderSolidUTF8>)), but this method draws
|
1833
|
+
like ((<SDL::TTF#drawShadedUTF8>)).
|
1834
|
+
|
1835
|
+
== MPEG stream
|
1836
|
+
|
1837
|
+
Needs SMPEG library.
|
1838
|
+
|
1839
|
+
If you will play mpeg with sound, you should call ((<SDL.init>)) with
|
1840
|
+
SDL::INIT_AUDIO, and call ((<SDL::Mixer.open>)).
|
1841
|
+
|
1842
|
+
Don't touch the destination surface while playing mpeg, because smpeg uses
|
1843
|
+
native thread.
|
1844
|
+
|
1845
|
+
Don't play sound with ((<SDL::Mixer>)) when playing mpeg, because smpeg
|
1846
|
+
hooks SDL_Mixer's playback functions.
|
1847
|
+
|
1848
|
+
=== SDL::MPEG
|
1849
|
+
|
1850
|
+
This class handles MPEG stream
|
1851
|
+
|
1852
|
+
==== super class
|
1853
|
+
|
1854
|
+
Object
|
1855
|
+
|
1856
|
+
==== class method
|
1857
|
+
|
1858
|
+
--- SDL::MPEG.load(filename)
|
1859
|
+
--- SDL::MPEG.new(filename)
|
1860
|
+
Create a new SDL::MPEG object from an MPEG file.
|
1861
|
+
|
1862
|
+
==== ��å�
|
1863
|
+
|
1864
|
+
--- SDL::MPEG#info
|
1865
|
+
Returns the current information of SDL::MPEG instance.
|
1866
|
+
Return value is a instance of ((<SDL::MPEG::Info>))
|
1867
|
+
|
1868
|
+
--- SDL::MPEG#enableAudio(enable)
|
1869
|
+
--- SDL::MPEG#enable_audio(enable)
|
1870
|
+
Enable or disable audio playback in MPEG stream.
|
1871
|
+
|
1872
|
+
--- SDL::MPEG#enableVideo(enable)
|
1873
|
+
--- SDL::MPEG#enable_video(enable)
|
1874
|
+
Enable or disable video playback in MPEG stream.
|
1875
|
+
|
1876
|
+
--- SDL::MPEG#status
|
1877
|
+
Returns the current status.Returns following value.
|
1878
|
+
SDL::MPEG::ERROR
|
1879
|
+
SDL::MPEG::STOPPED
|
1880
|
+
SDL::MPEG::PLAYING
|
1881
|
+
|
1882
|
+
--- SDL::MPEG#setVolume(volume)
|
1883
|
+
--- SDL::MPEG#set_volume(volume)
|
1884
|
+
Set the audio volume of an MPEG stream, in the range 0-100.
|
1885
|
+
|
1886
|
+
--- SDL::MPEG#setDisplay(surface)
|
1887
|
+
--- SDL::MPEG#set_display(surface)
|
1888
|
+
Set the destination surface for MPEG video playback.
|
1889
|
+
|
1890
|
+
--- SDL::MPEG#setLoop(repeat)
|
1891
|
+
--- SDL::MPEG#set_loop(repeat)
|
1892
|
+
Set or clear looping play.
|
1893
|
+
|
1894
|
+
--- SDL::MPEG#scaleXY(w,h)
|
1895
|
+
--- SDL::MPEG#scale_xy(w,h)
|
1896
|
+
Scale pixel display.
|
1897
|
+
|
1898
|
+
--- SDL::MPEG#scale(scale)
|
1899
|
+
Scale pixel display.
|
1900
|
+
|
1901
|
+
--- SDL::MPEG#move(x,y)
|
1902
|
+
Move the video display area within the destination surface.
|
1903
|
+
|
1904
|
+
--- SDL::MPEG#setDisplayRegion(x,y,w,h)
|
1905
|
+
--- SDL::MPEG#set_display_region(x,y,w,h)
|
1906
|
+
Set the region of the video to be shown.
|
1907
|
+
|
1908
|
+
--- SDL::MPEG#play
|
1909
|
+
Play an MPEG stream.
|
1910
|
+
|
1911
|
+
Warning: Don't access the surface while playing.
|
1912
|
+
|
1913
|
+
--- SDL::MPEG#pause
|
1914
|
+
Pause/Resume playback.
|
1915
|
+
|
1916
|
+
--- SDL::MPEG#stop
|
1917
|
+
Stop playback.
|
1918
|
+
|
1919
|
+
--- SDL::MPEG#rewind
|
1920
|
+
Rewind the play position of MPEG stream to the begining of the MPEG.
|
1921
|
+
|
1922
|
+
--- SDL::MPEG#seek(bytes)
|
1923
|
+
Seek 'bytes' bytes in the MPEG stream.
|
1924
|
+
|
1925
|
+
--- SDL::MPEG#skip(seconds)
|
1926
|
+
Skip 'seconds' seconds in the MPEG stream.
|
1927
|
+
|
1928
|
+
--- SDL::MPEG#renderFrame(framenum)
|
1929
|
+
--- SDL::MPEG#render_frame(framenum)
|
1930
|
+
Render a particular frame in the MPEG video.
|
1931
|
+
|
1932
|
+
--- SDL::MPEG#setFilter(filter)
|
1933
|
+
--- SDL::MPEG#set_filter(filter)
|
1934
|
+
Set video filter. Available filter is following.
|
1935
|
+
SDL::MPEG::NULL_FILTER No filter
|
1936
|
+
SDL::MPEG::BILINEAR_FILTER Bilinear filter
|
1937
|
+
SDL::MPEG::DEBLOCKING_FILTER Deblocking filter
|
1938
|
+
|
1939
|
+
=== SDL::MPEG::Info
|
1940
|
+
|
1941
|
+
The instance of this class has the information of ((<SDL::MPEG>)).
|
1942
|
+
Get that with ((<SDL::MPEG#info>)).
|
1943
|
+
|
1944
|
+
==== super class
|
1945
|
+
|
1946
|
+
Object
|
1947
|
+
|
1948
|
+
==== method
|
1949
|
+
|
1950
|
+
--- SDL::MPEG::Info#has_audio
|
1951
|
+
--- SDL::MPEG::Info#has_video
|
1952
|
+
--- SDL::MPEG::Info#width
|
1953
|
+
--- SDL::MPEG::Info#height
|
1954
|
+
--- SDL::MPEG::Info#current_frame
|
1955
|
+
--- SDL::MPEG::Info#current_fps
|
1956
|
+
--- SDL::MPEG::Info#audio_string
|
1957
|
+
--- SDL::MPEG::Info#audio_current_frame
|
1958
|
+
--- SDL::MPEG::Info#current_offset
|
1959
|
+
--- SDL::MPEG::Info#total_size
|
1960
|
+
--- SDL::MPEG::Info#current_time
|
1961
|
+
--- SDL::MPEG::Info#total_time
|
1962
|
+
|
1963
|
+
== Time
|
1964
|
+
|
1965
|
+
=== module function
|
1966
|
+
|
1967
|
+
--- SDL.getTicks
|
1968
|
+
--- SDL.get_ticks
|
1969
|
+
Get the number of milliseconds since the SDL library initialization.
|
1970
|
+
Note that this value wraps if the program runs for more than ~49 days.
|
1971
|
+
|
1972
|
+
--- SDL.delay(ms)
|
1973
|
+
Wait a specified number of milliseconds before returning. this
|
1974
|
+
function will wait at least the specified time, but possible
|
1975
|
+
longer due to OS scheduling.
|
1976
|
+
|
1977
|
+
== Japanese input method with SDLSKK
|
1978
|
+
|
1979
|
+
Needs SDLSKK library.
|
1980
|
+
|
1981
|
+
You need calling ((<SDL::Event2.enableUNICODE>)) after calling ((<SDL.init>))
|
1982
|
+
to use SDLSKK.
|
1983
|
+
|
1984
|
+
=== module function
|
1985
|
+
|
1986
|
+
--- SDL::SKK.encoding=(encoding)
|
1987
|
+
Set encoding of SDLSKK.
|
1988
|
+
* SDL::SKK::EUCJP
|
1989
|
+
* SDL::SKK::UTF8
|
1990
|
+
* SDL::SKK::SJIS
|
1991
|
+
|
1992
|
+
--- SDL::SKK.encoding
|
1993
|
+
Return encoding.
|
1994
|
+
|
1995
|
+
=== SDL::SKK::Context
|
1996
|
+
|
1997
|
+
This class represents the state of input.
|
1998
|
+
|
1999
|
+
==== super class
|
2000
|
+
|
2001
|
+
Object
|
2002
|
+
|
2003
|
+
==== class method
|
2004
|
+
|
2005
|
+
--- SDL::SKK::Context.new(dict,romkana_table,keybind,use_minibuffer)
|
2006
|
+
Create an instance of ((<SDL::SKK::Context>)) from the dictionary,
|
2007
|
+
the keybind and the RomKanaRuleTable. And if use_minibuffer is true, you
|
2008
|
+
can use minibuffer.
|
2009
|
+
|
2010
|
+
==== method
|
2011
|
+
|
2012
|
+
--- SDL::SKK::Context#input(event)
|
2013
|
+
Inputs from keyboard thorough event object.
|
2014
|
+
|
2015
|
+
--- SDL::SKK::Context#str
|
2016
|
+
Returns input (Japanese) string.
|
2017
|
+
|
2018
|
+
--- SDL::SKK::Context#render_str(font,r,g,b)
|
2019
|
+
Renders the text.
|
2020
|
+
|
2021
|
+
--- SDL::SKK::Context#render_minibuffer_str(font,r,g,b)
|
2022
|
+
Renders minibuffer text.
|
2023
|
+
|
2024
|
+
--- SDL::SKK::Context#clear
|
2025
|
+
Clears text and initializes context.
|
2026
|
+
|
2027
|
+
--- SDL::SKK::Context#get_basic_mode
|
2028
|
+
Returns whether context's state is basic mode.
|
2029
|
+
|
2030
|
+
If this method returns true, and you get return, you can
|
2031
|
+
stop inputting.
|
2032
|
+
|
2033
|
+
|
2034
|
+
=== SDL::SKK::Dictionary
|
2035
|
+
|
2036
|
+
==== super class
|
2037
|
+
|
2038
|
+
Object
|
2039
|
+
|
2040
|
+
==== class method
|
2041
|
+
|
2042
|
+
--- SDL::SKK::Dictionary.new
|
2043
|
+
Creates the instance of ((<SDL::SKK::Dictionary>)).
|
2044
|
+
The content of that is empty just after creating.
|
2045
|
+
|
2046
|
+
==== method
|
2047
|
+
|
2048
|
+
--- SDL::SKK::Dictionary#load(dictfile,users)
|
2049
|
+
Load dictionary from file.
|
2050
|
+
If users is true, then this method regards it as user's dictionary.
|
2051
|
+
|
2052
|
+
--- SDL::SKK::Dictionary#save(filename)
|
2053
|
+
Save user's dictionary.
|
2054
|
+
|
2055
|
+
=== SDL::SKK::RomKanaRuleTable
|
2056
|
+
|
2057
|
+
This class represents the rule of conversion from Alphabet to Japanese kana.
|
2058
|
+
|
2059
|
+
==== super class
|
2060
|
+
|
2061
|
+
Object
|
2062
|
+
|
2063
|
+
==== class method
|
2064
|
+
|
2065
|
+
--- SDL::SKK::RomKanaRuleTable.new(table_file)
|
2066
|
+
Create the instance of ((<SDL::SKK::RomKanaRuleTable>)) from rule file.
|
2067
|
+
|
2068
|
+
==== method
|
2069
|
+
|
2070
|
+
=== SDL::SKK::Keybind
|
2071
|
+
|
2072
|
+
This class represents the keybind in SDLSKK input system.
|
2073
|
+
|
2074
|
+
==== super class
|
2075
|
+
|
2076
|
+
Object
|
2077
|
+
|
2078
|
+
==== class method
|
2079
|
+
|
2080
|
+
--- SDL::SKK::Keybind.new
|
2081
|
+
Create the instance of ((<SDL::SKK::Keybind>)) without any keybind.
|
2082
|
+
|
2083
|
+
==== method
|
2084
|
+
|
2085
|
+
--- SDL::SKK::Keybind#set_key(key_str,cmd_str)
|
2086
|
+
Set keybind.
|
2087
|
+
|
2088
|
+
You can use following string as ((|key_str|)).
|
2089
|
+
* alphabet and other ascii character
|
2090
|
+
* "SPC" "TAB" "DEL" "RET" "UP" "DOWN" "RIGHT" "LEFT" "INSERT" "HOME" "END"
|
2091
|
+
"PAGEUP" "PAGEDOWN" "F1" "F2" "F3" "F4" "F5" "F6" "F7" "F8" "F9" "F10"
|
2092
|
+
"F11" "F12" "F13" "F14" "F15" "HELP"
|
2093
|
+
* Modified key like "C-a" or "M-C-a"
|
2094
|
+
|
2095
|
+
And you can following as ((|cmd_str|))
|
2096
|
+
* "backward-char",
|
2097
|
+
* "forward-char",
|
2098
|
+
* "backward-delete-char",
|
2099
|
+
* "delete-char",
|
2100
|
+
* "kakutei",
|
2101
|
+
* "kettei",
|
2102
|
+
* "space",
|
2103
|
+
* "keyboard-quit",
|
2104
|
+
* "set-mark-command",
|
2105
|
+
* "kill-region",
|
2106
|
+
* "yank",
|
2107
|
+
* "copy",
|
2108
|
+
* "graph-char",
|
2109
|
+
* "upper-char",
|
2110
|
+
* "lower-char",
|
2111
|
+
* "abbrev-input",
|
2112
|
+
* "latin-mode",
|
2113
|
+
* "previous-candidate",
|
2114
|
+
* "jisx0208-mode",
|
2115
|
+
* "toggle-kana",
|
2116
|
+
* "beginning-of-line"
|
2117
|
+
* "end-of-line"
|
2118
|
+
* "do-nothing"
|
2119
|
+
|
2120
|
+
You should not set any command on one ascii character like "a" or "/".
|
2121
|
+
|
2122
|
+
--- SDL::SKK::Keybind#set_default_key
|
2123
|
+
Set default keybind. You should call this method immediately after
|
2124
|
+
call ((<SDL::SKK::Keybind.new>))
|
2125
|
+
|
2126
|
+
--- SDL::SKK::Keybind#unset_key(key_str)
|
2127
|
+
Unset keybind.
|
2128
|
+
|
2129
|
+
== 3D drawing with OpenGL
|
2130
|
+
You can draw 3D graphics with OpenGL.
|
2131
|
+
|
2132
|
+
How to use OpenGL.
|
2133
|
+
(1) require 'sdl'; require 'opengl'
|
2134
|
+
(2) Call ((<SDL.init>)) with SDL::INIT_VIDEO
|
2135
|
+
(3) Set attribute of OpenGL, please use ((<SDL.setGLAttr>))
|
2136
|
+
(4) Call ((<SDL.setVideoMode>)) with SDL::OPENGL
|
2137
|
+
(5) Use GL module methods to draw
|
2138
|
+
(6) Call ((<SDL.GLSwapBuffersn>)) instead of ((<SDL.flip>)) to update screen
|
2139
|
+
|
2140
|
+
Please see sample/opengl.rb .
|
2141
|
+
|
2142
|
+
=== module function
|
2143
|
+
--- SDL.setGLAttr(attr,val)
|
2144
|
+
--- SDL.set_GL_attr(attr,val)
|
2145
|
+
Set the value of special SDL/OpenGL attribute.
|
2146
|
+
|
2147
|
+
List of attribute:
|
2148
|
+
* SDL::GL_RED_SIZE
|
2149
|
+
* SDL::GL_GREEN_SIZE
|
2150
|
+
* SDL::GL_BLUE_SIZE
|
2151
|
+
* SDL::GL_ALPHA_SIZE
|
2152
|
+
* SDL::GL_BUFFER_SIZE
|
2153
|
+
* SDL::GL_DOUBLEBUFFER
|
2154
|
+
* SDL::GL_DEPTH_SIZE
|
2155
|
+
* SDL::GL_STENCIL_SIZE
|
2156
|
+
* SDL::GL_ACCUM_RED_SIZE
|
2157
|
+
* SDL::GL_ACCUM_GREEN_SIZE
|
2158
|
+
* SDL::GL_ACCUM_BLUE_SIZE
|
2159
|
+
* SDL::GL_ACCUM_ALPHA_SIZE
|
2160
|
+
|
2161
|
+
--- SDL.getGLAttr(attr)
|
2162
|
+
--- SDL.get_GL_attr(attr)
|
2163
|
+
Get the value of special SDL/OpenGL attribute.
|
2164
|
+
|
2165
|
+
--- SDL.GLSwapBuffers
|
2166
|
+
--- SDL.GL_swap_buffers
|
2167
|
+
Swap the OpenGL buffers, update display, if double-buffering is supported.
|
2168
|
+
|
2169
|
+
== Others
|
2170
|
+
=== Avoid pthread problem
|
2171
|
+
You can possibly avoid Ruby/SDL pthread problem when you put following
|
2172
|
+
in your script.
|
2173
|
+
require 'rbconfig'
|
2174
|
+
|
2175
|
+
if RUBY_PLATFORM =~ /linux/
|
2176
|
+
trap('INT','EXIT')
|
2177
|
+
trap('EXIT','EXIT')
|
2178
|
+
end
|
2179
|
+
|
2180
|
+
=end
|