Module: SDL
- Extended by:
- NiceFFI::Library
- Defined in:
- lib/ruby-sdl-ffi/gfx.rb,
lib/ruby-sdl-ffi/sdl.rb,
lib/ruby-sdl-ffi/ttf.rb,
lib/ruby-sdl-ffi/image.rb,
lib/ruby-sdl-ffi/mixer.rb,
lib/ruby-sdl-ffi/sdl/core.rb,
lib/ruby-sdl-ffi/sdl/audio.rb,
lib/ruby-sdl-ffi/sdl/cdrom.rb,
lib/ruby-sdl-ffi/sdl/event.rb,
lib/ruby-sdl-ffi/sdl/mouse.rb,
lib/ruby-sdl-ffi/sdl/mutex.rb,
lib/ruby-sdl-ffi/sdl/rwops.rb,
lib/ruby-sdl-ffi/sdl/timer.rb,
lib/ruby-sdl-ffi/sdl/video.rb,
lib/ruby-sdl-ffi/sdl/keysyms.rb,
lib/ruby-sdl-ffi/gfx/blitfunc.rb,
lib/ruby-sdl-ffi/gfx/rotozoom.rb,
lib/ruby-sdl-ffi/sdl/joystick.rb,
lib/ruby-sdl-ffi/sdl/keyboard.rb,
lib/ruby-sdl-ffi/gfx/framerate.rb,
lib/ruby-sdl-ffi/gfx/primitives.rb,
lib/ruby-sdl-ffi/gfx/imagefilter.rb
Defined Under Namespace
Modules: Gfx, Image, Mac, Mixer, TTF
Classes: ActiveEvent, AudioSpec, CD, CDtrack, Color, Cursor, Event, ExposeEvent, JoyAxisEvent, JoyBallEvent, JoyButtonEvent, JoyHatEvent, Joystick, KeyboardEvent, Keysym, MouseButtonEvent, MouseMotionEvent, Overlay, Palette, PixelFormat, QuitEvent, RWops, RWopsHidden, RWopsHiddenMem, RWopsHiddenStdio, RWopsHiddenUnknown, Rect, ResizeEvent, Surface, SysWMEvent, UserEvent, Version, VideoInfo
Constant Summary
collapse
- LOAD_PATHS =
NiceFFI::PathSet::DEFAULT.dup
- ENUM =
Aliases for integer-like types
:int
- BOOL =
:int
- GLATTR =
:int
- LIL_ENDIAN =
1234
- BIG_ENDIAN =
4321
- INIT_TIMER =
0x00000001
- INIT_AUDIO =
0x00000010
- INIT_VIDEO =
0x00000020
- INIT_CDROM =
0x00000100
- INIT_JOYSTICK =
0x00000200
- INIT_NOPARACHUTE =
0x00100000
- INIT_EVENTTHREAD =
0x01000000
- INIT_EVERYTHING =
0x0000FFFF
- APPMOUSEFOCUS =
0x01
- APPINPUTFOCUS =
0x02
- APPACTIVE =
0x04
- ENOMEM =
0
- EFREAD =
1
- EFWRITE =
2
- EFSEEK =
3
- UNSUPPORTED =
4
- LASTERROR =
5
- AUDIO_U8 =
0x0008
- AUDIO_S8 =
0x8008
- AUDIO_U16LSB =
0x0010
- AUDIO_S16LSB =
0x8010
- AUDIO_U16MSB =
0x1010
- AUDIO_S16MSB =
0x9010
- AUDIO_U16 =
0x0010
- AUDIO_S16 =
0x8010
- AUDIO_U16SYS =
AUDIO_U16MSB
- AUDIO_S16SYS =
AUDIO_U16MSB
- AUDIO_STOPPED =
0
- AUDIO_PLAYING =
1
- AUDIO_PAUSED =
2
- MIX_MAXVOLUME =
128
- CD_ERROR =
-1
- CD_TRAYEMPTY =
0
- CD_STOPPED =
1
- CD_PLAYING =
2
- CD_PAUSED =
3
- AUDIO_TRACK =
0x00
- DATA_TRACK =
0x04
- MAX_TRACKS =
99
- CD_FPS =
75
- RELEASED =
0
- PRESSED =
1
- NOEVENT =
0
- ACTIVEEVENT =
1
- KEYDOWN =
2
- KEYUP =
3
- MOUSEMOTION =
4
- MOUSEBUTTONDOWN =
5
- MOUSEBUTTONUP =
6
- JOYAXISMOTION =
7
- JOYBALLMOTION =
8
- JOYHATMOTION =
9
- JOYBUTTONDOWN =
10
- JOYBUTTONUP =
11
- QUIT =
12
- SYSWMEVENT =
13
- EVENT_RESERVEDA =
14
- EVENT_RESERVEDB =
15
- VIDEORESIZE =
16
- VIDEOEXPOSE =
17
- EVENT_RESERVED2 =
18
- EVENT_RESERVED3 =
19
- EVENT_RESERVED4 =
20
- EVENT_RESERVED5 =
21
- EVENT_RESERVED6 =
22
- EVENT_RESERVED7 =
23
- USEREVENT =
24
- NUMEVENTS =
32
- ACTIVEEVENTMASK =
(1 << (ACTIVEEVENT))
- JOYAXISMOTIONMASK =
(1 << (JOYAXISMOTION))
- JOYEVENTMASK =
(1 << (JOYAXISMOTION)) | \
(1 << (JOYBALLMOTION)) | \
(1 << (JOYHATMOTION)) | \
(1 << (JOYBUTTONDOWN)) | \
(1 << (JOYBUTTONUP))
- JOYBALLMOTIONMASK =
(1 << (JOYBALLMOTION))
- JOYBUTTONDOWNMASK =
(1 << (JOYBUTTONDOWN))
- JOYBUTTONUPMASK =
(1 << (JOYBUTTONUP))
- JOYHATMOTIONMASK =
(1 << (JOYHATMOTION))
- KEYDOWNMASK =
(1 << (KEYDOWN))
- KEYEVENTMASK =
(1 << (KEYDOWN))|(1 << (KEYUP))
- KEYUPMASK =
(1 << (KEYUP))
- MOUSEBUTTONDOWNMASK =
(1 << (MOUSEBUTTONDOWN))
- MOUSEBUTTONUPMASK =
(1 << (MOUSEBUTTONUP))
- MOUSEMOTIONMASK =
(1 << (MOUSEMOTION))
- MOUSEEVENTMASK =
(1 << (MOUSEMOTION)) | \
(1 << (MOUSEBUTTONDOWN)) | \
(1 << (MOUSEBUTTONUP))
- QUITMASK =
(1 << (QUIT))
- SYSWMEVENTMASK =
(1 << (SYSWMEVENT))
- VIDEOEXPOSEMASK =
(1 << (VIDEOEXPOSE))
- VIDEORESIZEMASK =
(1 << (VIDEORESIZE))
- ALLEVENTS =
0xFFFFFFFF
- ADDEVENT =
0
- PEEKEVENT =
1
- GETEVENT =
2
- QUERY =
-1
- IGNORE =
0
- DISABLE =
0
- ENABLE =
1
- BUTTON_LEFT =
1
- BUTTON_MIDDLE =
2
- BUTTON_RIGHT =
3
- BUTTON_WHEELUP =
4
- BUTTON_WHEELDOWN =
5
- BUTTON_X1 =
6
- BUTTON_X2 =
7
- BUTTON_LMASK =
1 << (BUTTON_LEFT - 1)
- BUTTON_MMASK =
1 << (BUTTON_MIDDLE - 1)
- BUTTON_RMASK =
1 << (BUTTON_RIGHT - 1)
- BUTTON_X1MASK =
1 << (BUTTON_X1 - 1)
- BUTTON_X2MASK =
1 << (BUTTON_X2 - 1)
- MUTEX_TIMEDOUT =
1
- RW_SEEK_SET =
0
- RW_SEEK_CUR =
1
- RW_SEEK_END =
2
- TIMESLICE =
10
- TIMER_RESOLUTION =
10
- ALPHA_OPAQUE =
255
- ALPHA_TRANSPARENT =
0
- SWSURFACE =
0x00000000
- HWSURFACE =
0x00000001
- ASYNCBLIT =
0x00000004
- ANYFORMAT =
0x10000000
- HWPALETTE =
0x20000000
- DOUBLEBUF =
0x40000000
- FULLSCREEN =
0x80000000
- OPENGL =
0x00000002
- OPENGLBLIT =
0x0000000A
- RESIZABLE =
0x00000010
- NOFRAME =
0x00000020
- HWACCEL =
0x00000100
- SRCCOLORKEY =
0x00001000
- RLEACCELOK =
0x00002000
- RLEACCEL =
0x00004000
- SRCALPHA =
0x00010000
- PREALLOC =
0x01000000
- YV12_OVERLAY =
0x32315659
- IYUV_OVERLAY =
0x56555949
- YUY2_OVERLAY =
0x32595559
- UYVY_OVERLAY =
0x59565955
- YVYU_OVERLAY =
0x55595659
- GL_RED_SIZE =
0
- GL_GREEN_SIZE =
1
- GL_BLUE_SIZE =
2
- GL_ALPHA_SIZE =
3
- GL_BUFFER_SIZE =
4
- GL_DOUBLEBUFFER =
5
- GL_DEPTH_SIZE =
6
- GL_STENCIL_SIZE =
7
- GL_ACCUM_RED_SIZE =
8
- GL_ACCUM_GREEN_SIZE =
9
- GL_ACCUM_BLUE_SIZE =
10
- GL_ACCUM_ALPHA_SIZE =
11
- GL_STEREO =
12
- GL_MULTISAMPLEBUFFERS =
13
- GL_MULTISAMPLESAMPLES =
14
- GL_ACCELERATED_VISUAL =
15
- GL_SWAP_CONTROL =
16
- LOGPAL =
0x01
- PHYSPAL =
0x02
- GRAB_QUERY =
-1
- GRAB_OFF =
0
- GRAB_ON =
1
- GRAB_FULLSCREEN =
2
- K_FIRST =
0
- K_UNKNOWN =
0
- K_BACKSPACE =
8
- K_TAB =
9
- K_CLEAR =
12
- K_RETURN =
13
- K_PAUSE =
19
- K_ESCAPE =
27
- K_SPACE =
32
- K_EXCLAIM =
33
- K_QUOTEDBL =
34
- K_HASH =
35
- K_DOLLAR =
36
- K_AMPERSAND =
38
- K_QUOTE =
39
- K_LEFTPAREN =
40
- K_RIGHTPAREN =
41
- K_ASTERISK =
42
- K_PLUS =
43
- K_COMMA =
44
- K_MINUS =
45
- K_PERIOD =
46
- K_SLASH =
47
- K_0 =
48
- K_1 =
49
- K_2 =
50
- K_3 =
51
- K_4 =
52
- K_5 =
53
- K_6 =
54
- K_7 =
55
- K_8 =
56
- K_9 =
57
- K_COLON =
58
- K_SEMICOLON =
59
- K_LESS =
60
- K_EQUALS =
61
- K_GREATER =
62
- K_QUESTION =
63
- K_AT =
64
- K_LEFTBRACKET =
91
- K_BACKSLASH =
92
- K_RIGHTBRACKET =
93
- K_CARET =
94
- K_UNDERSCORE =
95
- K_BACKQUOTE =
96
- K_a =
97
- K_b =
98
- K_c =
99
- K_d =
100
- K_e =
101
- K_f =
102
- K_g =
103
- K_h =
104
- K_i =
105
- K_j =
106
- K_k =
107
- K_l =
108
- K_m =
109
- K_n =
110
- K_o =
111
- K_p =
112
- K_q =
113
- K_r =
114
- K_s =
115
- K_t =
116
- K_u =
117
- K_v =
118
- K_w =
119
- K_x =
120
- K_y =
121
- K_z =
122
- K_DELETE =
127
- K_WORLD_0 =
160
- K_WORLD_1 =
161
- K_WORLD_2 =
162
- K_WORLD_3 =
163
- K_WORLD_4 =
164
- K_WORLD_5 =
165
- K_WORLD_6 =
166
- K_WORLD_7 =
167
- K_WORLD_8 =
168
- K_WORLD_9 =
169
- K_WORLD_10 =
170
- K_WORLD_11 =
171
- K_WORLD_12 =
172
- K_WORLD_13 =
173
- K_WORLD_14 =
174
- K_WORLD_15 =
175
- K_WORLD_16 =
176
- K_WORLD_17 =
177
- K_WORLD_18 =
178
- K_WORLD_19 =
179
- K_WORLD_20 =
180
- K_WORLD_21 =
181
- K_WORLD_22 =
182
- K_WORLD_23 =
183
- K_WORLD_24 =
184
- K_WORLD_25 =
185
- K_WORLD_26 =
186
- K_WORLD_27 =
187
- K_WORLD_28 =
188
- K_WORLD_29 =
189
- K_WORLD_30 =
190
- K_WORLD_31 =
191
- K_WORLD_32 =
192
- K_WORLD_33 =
193
- K_WORLD_34 =
194
- K_WORLD_35 =
195
- K_WORLD_36 =
196
- K_WORLD_37 =
197
- K_WORLD_38 =
198
- K_WORLD_39 =
199
- K_WORLD_40 =
200
- K_WORLD_41 =
201
- K_WORLD_42 =
202
- K_WORLD_43 =
203
- K_WORLD_44 =
204
- K_WORLD_45 =
205
- K_WORLD_46 =
206
- K_WORLD_47 =
207
- K_WORLD_48 =
208
- K_WORLD_49 =
209
- K_WORLD_50 =
210
- K_WORLD_51 =
211
- K_WORLD_52 =
212
- K_WORLD_53 =
213
- K_WORLD_54 =
214
- K_WORLD_55 =
215
- K_WORLD_56 =
216
- K_WORLD_57 =
217
- K_WORLD_58 =
218
- K_WORLD_59 =
219
- K_WORLD_60 =
220
- K_WORLD_61 =
221
- K_WORLD_62 =
222
- K_WORLD_63 =
223
- K_WORLD_64 =
224
- K_WORLD_65 =
225
- K_WORLD_66 =
226
- K_WORLD_67 =
227
- K_WORLD_68 =
228
- K_WORLD_69 =
229
- K_WORLD_70 =
230
- K_WORLD_71 =
231
- K_WORLD_72 =
232
- K_WORLD_73 =
233
- K_WORLD_74 =
234
- K_WORLD_75 =
235
- K_WORLD_76 =
236
- K_WORLD_77 =
237
- K_WORLD_78 =
238
- K_WORLD_79 =
239
- K_WORLD_80 =
240
- K_WORLD_81 =
241
- K_WORLD_82 =
242
- K_WORLD_83 =
243
- K_WORLD_84 =
244
- K_WORLD_85 =
245
- K_WORLD_86 =
246
- K_WORLD_87 =
247
- K_WORLD_88 =
248
- K_WORLD_89 =
249
- K_WORLD_90 =
250
- K_WORLD_91 =
251
- K_WORLD_92 =
252
- K_WORLD_93 =
253
- K_WORLD_94 =
254
- K_WORLD_95 =
255
- K_KP0 =
256
- K_KP1 =
257
- K_KP2 =
258
- K_KP3 =
259
- K_KP4 =
260
- K_KP5 =
261
- K_KP6 =
262
- K_KP7 =
263
- K_KP8 =
264
- K_KP9 =
265
- K_KP_PERIOD =
266
- K_KP_DIVIDE =
267
- K_KP_MULTIPLY =
268
- K_KP_MINUS =
269
- K_KP_PLUS =
270
- K_KP_ENTER =
271
- K_KP_EQUALS =
272
- K_UP =
273
- K_DOWN =
274
- K_RIGHT =
275
- K_LEFT =
276
- K_INSERT =
277
- K_HOME =
278
- K_END =
279
- K_PAGEUP =
280
- K_PAGEDOWN =
281
- K_F1 =
282
- K_F2 =
283
- K_F3 =
284
- K_F4 =
285
- K_F5 =
286
- K_F6 =
287
- K_F7 =
288
- K_F8 =
289
- K_F9 =
290
- K_F10 =
291
- K_F11 =
292
- K_F12 =
293
- K_F13 =
294
- K_F14 =
295
- K_F15 =
296
- K_NUMLOCK =
300
- K_CAPSLOCK =
301
- K_SCROLLOCK =
302
- K_RSHIFT =
303
- K_LSHIFT =
304
- K_RCTRL =
305
- K_LCTRL =
306
- K_RALT =
307
- K_LALT =
308
- K_RMETA =
309
- K_LMETA =
310
- K_LSUPER =
311
- K_RSUPER =
312
- K_MODE =
313
- K_COMPOSE =
314
- K_HELP =
315
- K_PRINT =
316
- K_SYSREQ =
317
- K_BREAK =
318
319
- K_POWER =
320
- K_EURO =
321
- K_UNDO =
322
- K_LAST =
323
- KMOD_NONE =
0x0000
- KMOD_LSHIFT =
0x0001
- KMOD_RSHIFT =
0x0002
- KMOD_LCTRL =
0x0040
- KMOD_RCTRL =
0x0080
- KMOD_LALT =
0x0100
- KMOD_RALT =
0x0200
- KMOD_LMETA =
0x0400
- KMOD_RMETA =
0x0800
- KMOD_NUM =
0x1000
- KMOD_CAPS =
0x2000
- KMOD_MODE =
0x4000
- KMOD_RESERVED =
0x8000
- HAT_CENTERED =
0x00
- HAT_UP =
0x01
- HAT_RIGHT =
0x02
- HAT_DOWN =
0x04
- HAT_LEFT =
0x08
- HAT_RIGHTUP =
(HAT_RIGHT|HAT_UP)
- HAT_RIGHTDOWN =
(HAT_RIGHT|HAT_DOWN)
- HAT_LEFTUP =
(HAT_LEFT |HAT_UP)
- HAT_LEFTDOWN =
(HAT_LEFT |HAT_DOWN)
- ALL_HOTKEYS =
0xFFFFFFFF
- DEFAULT_REPEAT_DELAY =
500
- DEFAULT_REPEAT_INTERVAL =
30
Class Method Summary
collapse
Class Method Details
.AudioDriverName ⇒ Object
102
103
104
105
106
107
108
109
110
|
# File 'lib/ruby-sdl-ffi/sdl/audio.rb', line 102
def self.AudioDriverName
b = FFI::Buffer.new(:char, 1024)
result = __AudioDriverName( b, 1024 )
if result.null?
nil
else
b.get_string(0,1024)
end
end
|
.GetClipRect(surface) ⇒ Object
414
415
416
417
418
|
# File 'lib/ruby-sdl-ffi/sdl/video.rb', line 414
def self.GetClipRect( surface )
mp = FFI::Buffer.new( Rect )
__SDL_GetClipRect( surface, mp )
return Rect.new( mp )
end
|
.GetGammaRamp ⇒ Object
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
|
# File 'lib/ruby-sdl-ffi/sdl/video.rb', line 335
def self.GetGammaRamp()
rtable = FFI::Buffer.new( :uint16, 256 )
gtable = FFI::Buffer.new( :uint16, 256 )
btable = FFI::Buffer.new( :uint16, 256 )
n = __SDL_GetGammaRamp( rtable, gtable, btable )
if( n == -1 )
return nil
else
return [ rtable.get_array_of_uint16(0, 256),
gtable.get_array_of_uint16(0, 256),
btable.get_array_of_uint16(0, 256) ]
end
end
|
.GetKeyRepeat ⇒ Object
55
56
57
58
59
60
|
# File 'lib/ruby-sdl-ffi/sdl/keyboard.rb', line 55
def self.GetKeyRepeat()
delay = FFI::Buffer.new( :int )
interval = FFI::Buffer.new( :int )
__SDL_GetKeyRepeat( delay, interval )
return [delay.get_int(0), interval.get_int(0)]
end
|
.GetKeyState ⇒ Object
65
66
67
68
69
|
# File 'lib/ruby-sdl-ffi/sdl/keyboard.rb', line 65
def self.GetKeyState()
numkeys = FFI::Buffer.new( :int )
keys = __SDL_GetKeyState( numkeys )
return keys.get_array_of_uint8( 0, numkeys.get_int(0) )
end
|
.GetMouseState ⇒ Object
Returns [buttons, x, y].
buttons: buttons currently pressed (bitmask of BUTTON_*MASK constants).
x, y: current position of the mouse cursor.
57
58
59
60
61
62
|
# File 'lib/ruby-sdl-ffi/sdl/mouse.rb', line 57
def self.GetMouseState()
xmp = FFI::Buffer.new( :int )
ymp = FFI::Buffer.new( :int )
buttons = __SDL_GetMouseState( xmp, ymp )
return [buttons, xmp.get_int(0), ymp.get_int(0)]
end
|
.GetRelativeMouseState ⇒ Object
Returns [buttons, x, y].
buttons: buttons currently pressed (bitmask of BUTTON_*MASK constants).
x, y: movement of the mouse cursor since last call of this method.
72
73
74
75
76
77
|
# File 'lib/ruby-sdl-ffi/sdl/mouse.rb', line 72
def self.GetRelativeMouseState()
xmp = FFI::Buffer.new( :int )
ymp = FFI::Buffer.new( :int )
buttons = __SDL_GetRelativeMouseState( xmp, ymp )
return [buttons, xmp.get_int(0), ymp.get_int(0)]
end
|
.GetRGB(uint32, format) ⇒ Object
361
362
363
364
365
366
367
|
# File 'lib/ruby-sdl-ffi/sdl/video.rb', line 361
def self.GetRGB( uint32, format )
r = FFI::Buffer.new( :uint8 )
g = FFI::Buffer.new( :uint8 )
b = FFI::Buffer.new( :uint8 )
__SDL_GetRGB( uint32, format, r, g, b )
return [r.get_uint8(0), g.get_uint8(0), b.get_uint8(0)]
end
|
.GetRGBA(uint32, format) ⇒ Object
375
376
377
378
379
380
381
382
|
# File 'lib/ruby-sdl-ffi/sdl/video.rb', line 375
def self.GetRGBA( uint32, format )
r = FFI::Buffer.new( :uint8 )
g = FFI::Buffer.new( :uint8 )
b = FFI::Buffer.new( :uint8 )
a = FFI::Buffer.new( :uint8 )
__SDL_GetRGBA( uint32, format, r, g, b, a )
return [r.get_uint8(0), g.get_uint8(0), b.get_uint8(0), a.get_uint8(0)]
end
|
.GL_GetAttribute(attrib) ⇒ Object
453
454
455
456
457
458
459
460
461
|
# File 'lib/ruby-sdl-ffi/sdl/video.rb', line 453
def self.GL_GetAttribute( attrib )
buffer = FFI::Buffer.new( :int )
result = __GL_GetAttribute( attrib, buffer )
if( result == -1 )
return nil
else
return buffer.get_int(0)
end
end
|
.PeepEvents(events, action, mask) ⇒ Object
Behavior varies depending on action.
PEEKEVENT or GETEVENT:
events is the max number of events to retrieve.
Returns an array of Events, or nil if there was an error.
GETEVENT removes them from the queue, PEEKEVENT leaves them.
ADDEVENT:
events is an array of Events (or specific event instances)
to append to the queue.
Returns the number of events added, or -1 if there was an error.
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
|
# File 'lib/ruby-sdl-ffi/sdl/event.rb', line 275
def self.PeepEvents( events, action, mask )
case action
when ADDEVENT
numevents = events.size
mp = FFI::Buffer.new( SDL::Event, numevents )
events.each_with_index do |ev, i|
mp[i].put_bytes( 0, ev.pointer.get_bytes(0, ev.size) )
end
return __SDL_PeepEvents( mp, numevents, action, mask )
when PEEKEVENT, GETEVENT
numevents = events.to_i
mp = FFI::Buffer.new( SDL::Event, numevents )
n = __SDL_PeepEvents( mp, numevents, action, mask )
return nil if( n == -1 )
events = []
n.times do |i|
events << Event.new( mp[i] ).unwrap
end
return events
end
end
|
.PollEvent ⇒ Object
315
316
317
318
319
320
321
322
323
|
# File 'lib/ruby-sdl-ffi/sdl/event.rb', line 315
def self.PollEvent()
mp = FFI::Buffer.new( SDL::Event, 1 )
n = __SDL_PollEvent( mp )
if n == 0
nil
else
Event.new(mp).unwrap
end
end
|
.sdl_func(name, args, ret) ⇒ Object
53
54
55
|
# File 'lib/ruby-sdl-ffi/sdl.rb', line 53
def self.sdl_func( name, args, ret )
func name, "SDL_#{name}", args, ret
end
|
.set_app_name(app_name) ⇒ Object
Sets the application name, if the platform supports it. This method is safe to call even on platforms which do not support it (but does nothing). Currently this method only has an effect on Mac OS X.
The effect of this method depends on the platform. On Mac OS X, it sets the text used in the main application menu.
(Note: this method does not correspond to any part of the SDL API. It communicates with the platform directly.)
Example:
SDL.set_app_name("SpaceQuest 4000")
302
303
304
305
306
307
|
# File 'lib/ruby-sdl-ffi/sdl/video.rb', line 302
def self.set_app_name( app_name )
if defined? SDL::Mac
SDL::Mac.set_app_name( app_name )
end
nil
end
|
.SetEventFilter(&block) ⇒ Object
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
|
# File 'lib/ruby-sdl-ffi/sdl/event.rb', line 348
def self.SetEventFilter( &block )
if( block_given? )
proc = Proc.new { |ev|
result = block.call( Event.new(ev).unwrap )
case result
when true; 1
when false, nil; 0
else; result
end
}
__SDL_SetEventFilter( proc )
else
__SDL_SetEventFilter( nil )
end
end
|
.SetVideoMode(*args) ⇒ Object
278
279
280
281
282
283
284
285
|
# File 'lib/ruby-sdl-ffi/sdl/video.rb', line 278
def self.SetVideoMode( *args )
result = __SetVideoMode(*args)
if defined? SDL::Mac
SDL::Mac::HIServices.make_current_front
SDL::Mac.("ruby")
end
return result
end
|
.UpdateRects(surf, rects) ⇒ Object
312
313
314
315
316
317
318
319
320
|
# File 'lib/ruby-sdl-ffi/sdl/video.rb', line 312
def self.UpdateRects( surf, rects )
rects_mp = FFI::Buffer.new( Rect, rects.length )
rects.each_with_index do |rect, i|
rects_mp[i].put_bytes( 0, rect.to_bytes )
end
__UpdateRects( surf, rects.length, rects_mp )
end
|
.WaitEvent ⇒ Object
328
329
330
331
332
333
334
335
336
|
# File 'lib/ruby-sdl-ffi/sdl/event.rb', line 328
def self.WaitEvent()
mp = FFI::Buffer.new( SDL::Event, 1 )
n = __SDL_WaitEvent( mp )
if n == 0
nil
else
Event.new(mp).unwrap
end
end
|
.WM_GetCaption ⇒ Object
476
477
478
479
480
481
482
|
# File 'lib/ruby-sdl-ffi/sdl/video.rb', line 476
def self.WM_GetCaption()
title = FFI::Buffer.new( :pointer )
icont = FFI::Buffer.new( :pointer )
__SDL_WM_GetCaption( title, icont )
return [ title.get_pointer(0).get_string(0),
icont.get_pointer(0).get_string(0) ]
end
|