SDL

Constants

ACTIVEEVENT
ACTIVEEVENTMASK
ADDEVENT
ALLEVENTS
ALL_HOTKEYS
ALPHA_OPAQUE
ALPHA_TRANSPARENT
ANYFORMAT
APPACTIVE
APPINPUTFOCUS
APPMOUSEFOCUS

SDL_active.h

ASYNCBLIT
AUDIO_PAUSED
AUDIO_PLAYING
AUDIO_S16
AUDIO_S16LSB
AUDIO_S16MSB
AUDIO_S16SYS
AUDIO_S8
AUDIO_STOPPED
AUDIO_TRACK
AUDIO_U16
AUDIO_U16LSB
AUDIO_U16MSB
AUDIO_U16SYS
AUDIO_U8
BIG_ENDIAN
BUTTON_LEFT
BUTTON_LMASK
BUTTON_MIDDLE
BUTTON_MMASK
BUTTON_RIGHT
BUTTON_RMASK
BUTTON_WHEELDOWN
BUTTON_WHEELUP
BUTTON_X1
BUTTON_X1MASK
BUTTON_X2
BUTTON_X2MASK
CD_ERROR
CD_FPS
CD_PAUSED
CD_PLAYING
CD_STOPPED
CD_TRAYEMPTY
DATA_TRACK
DEFAULT_REPEAT_DELAY
DEFAULT_REPEAT_INTERVAL
DISABLE
DOUBLEBUF
EFREAD
EFSEEK
EFWRITE
ENABLE
ENOMEM
EVENT_RESERVED2
EVENT_RESERVED3
EVENT_RESERVED4
EVENT_RESERVED5
EVENT_RESERVED6
EVENT_RESERVED7
EVENT_RESERVEDA
EVENT_RESERVEDB
FULLSCREEN
GETEVENT
GL_ACCELERATED_VISUAL
GL_ACCUM_ALPHA_SIZE
GL_ACCUM_BLUE_SIZE
GL_ACCUM_GREEN_SIZE
GL_ACCUM_RED_SIZE
GL_ALPHA_SIZE
GL_BLUE_SIZE
GL_BUFFER_SIZE
GL_DEPTH_SIZE
GL_DOUBLEBUFFER
GL_GREEN_SIZE
GL_MULTISAMPLEBUFFERS
GL_MULTISAMPLESAMPLES
GL_RED_SIZE
GL_STENCIL_SIZE
GL_STEREO
GL_SWAP_CONTROL
GRAB_FULLSCREEN
GRAB_OFF
GRAB_ON
GRAB_QUERY
HAT_CENTERED
HAT_DOWN
HAT_LEFT
HAT_LEFTDOWN
HAT_LEFTUP
HAT_RIGHT
HAT_RIGHTDOWN
HAT_RIGHTUP
HAT_UP
HWACCEL
HWPALETTE
HWSURFACE
IGNORE
INIT_AUDIO
INIT_CDROM
INIT_EVENTTHREAD
INIT_EVERYTHING
INIT_JOYSTICK
INIT_NOPARACHUTE
INIT_TIMER
INIT_VIDEO
IYUV_OVERLAY
JOYAXISMOTION
JOYAXISMOTIONMASK
JOYBALLMOTION
JOYBALLMOTIONMASK
JOYBUTTONDOWN
JOYBUTTONDOWNMASK
JOYBUTTONUP
JOYBUTTONUPMASK
JOYEVENTMASK
JOYHATMOTION
JOYHATMOTIONMASK
KEYDOWN
KEYDOWNMASK
KEYEVENTMASK
KEYUP
KEYUPMASK
KMOD_CAPS
KMOD_LALT
KMOD_LCTRL
KMOD_LMETA
KMOD_LSHIFT
KMOD_MODE
KMOD_NONE
KMOD_NUM
KMOD_RALT
KMOD_RCTRL
KMOD_RESERVED
KMOD_RMETA
KMOD_RSHIFT
K_0
K_1
K_2
K_3
K_4
K_5
K_6
K_7
K_8
K_9
K_AMPERSAND
K_ASTERISK
K_AT
K_BACKQUOTE
K_BACKSLASH
K_BACKSPACE
K_BREAK
K_CAPSLOCK
K_CARET
K_CLEAR
K_COLON
K_COMMA
K_COMPOSE
K_DELETE
K_DOLLAR
K_DOWN
K_END
K_EQUALS
K_ESCAPE
K_EURO
K_EXCLAIM
K_F1
K_F10
K_F11
K_F12
K_F13
K_F14
K_F15
K_F2
K_F3
K_F4
K_F5
K_F6
K_F7
K_F8
K_F9
K_FIRST
K_GREATER
K_HASH
K_HELP
K_HOME
K_INSERT
K_KP0
K_KP1
K_KP2
K_KP3
K_KP4
K_KP5
K_KP6
K_KP7
K_KP8
K_KP9
K_KP_DIVIDE
K_KP_ENTER
K_KP_EQUALS
K_KP_MINUS
K_KP_MULTIPLY
K_KP_PERIOD
K_KP_PLUS
K_LALT
K_LAST
K_LCTRL
K_LEFT
K_LEFTBRACKET
K_LEFTPAREN
K_LESS
K_LMETA
K_LSHIFT
K_LSUPER
K_MENU
K_MINUS
K_MODE
K_NUMLOCK
K_PAGEDOWN
K_PAGEUP
K_PAUSE
K_PERIOD
K_PLUS
K_POWER
K_PRINT
K_QUESTION
K_QUOTE
K_QUOTEDBL
K_RALT
K_RCTRL
K_RETURN
K_RIGHT
K_RIGHTBRACKET
K_RIGHTPAREN
K_RMETA
K_RSHIFT
K_RSUPER
K_SCROLLOCK
K_SEMICOLON
K_SLASH
K_SPACE
K_SYSREQ
K_TAB
K_UNDERSCORE
K_UNDO
K_UNKNOWN
K_UP
K_WORLD_0
K_WORLD_1
K_WORLD_10
K_WORLD_11
K_WORLD_12
K_WORLD_13
K_WORLD_14
K_WORLD_15
K_WORLD_16
K_WORLD_17
K_WORLD_18
K_WORLD_19
K_WORLD_2
K_WORLD_20
K_WORLD_21
K_WORLD_22
K_WORLD_23
K_WORLD_24
K_WORLD_25
K_WORLD_26
K_WORLD_27
K_WORLD_28
K_WORLD_29
K_WORLD_3
K_WORLD_30
K_WORLD_31
K_WORLD_32
K_WORLD_33
K_WORLD_34
K_WORLD_35
K_WORLD_36
K_WORLD_37
K_WORLD_38
K_WORLD_39
K_WORLD_4
K_WORLD_40
K_WORLD_41
K_WORLD_42
K_WORLD_43
K_WORLD_44
K_WORLD_45
K_WORLD_46
K_WORLD_47
K_WORLD_48
K_WORLD_49
K_WORLD_5
K_WORLD_50
K_WORLD_51
K_WORLD_52
K_WORLD_53
K_WORLD_54
K_WORLD_55
K_WORLD_56
K_WORLD_57
K_WORLD_58
K_WORLD_59
K_WORLD_6
K_WORLD_60
K_WORLD_61
K_WORLD_62
K_WORLD_63
K_WORLD_64
K_WORLD_65
K_WORLD_66
K_WORLD_67
K_WORLD_68
K_WORLD_69
K_WORLD_7
K_WORLD_70
K_WORLD_71
K_WORLD_72
K_WORLD_73
K_WORLD_74
K_WORLD_75
K_WORLD_76
K_WORLD_77
K_WORLD_78
K_WORLD_79
K_WORLD_8
K_WORLD_80
K_WORLD_81
K_WORLD_82
K_WORLD_83
K_WORLD_84
K_WORLD_85
K_WORLD_86
K_WORLD_87
K_WORLD_88
K_WORLD_89
K_WORLD_9
K_WORLD_90
K_WORLD_91
K_WORLD_92
K_WORLD_93
K_WORLD_94
K_WORLD_95
K_a
K_b
K_c
K_d
K_e
K_f
K_g
K_h
K_i
K_j
K_k
K_l
K_m
K_n
K_o
K_p
K_q
K_r
K_s
K_t
K_u
K_v
K_w
K_x
K_y
K_z
LASTERROR
LIL_ENDIAN
LOAD_PATHS
LOGPAL
MAX_TRACKS
MIX_MAXVOLUME
MOUSEBUTTONDOWN
MOUSEBUTTONDOWNMASK
MOUSEBUTTONUP
MOUSEBUTTONUPMASK
MOUSEEVENTMASK
MOUSEMOTION
MOUSEMOTIONMASK
MUTEX_TIMEDOUT
NOEVENT
NOFRAME
NUMEVENTS
OPENGL
OPENGLBLIT
PEEKEVENT
PHYSPAL
PREALLOC
PRESSED
QUERY

sdl_func :GetEventFilter, [ ], :eventfilter_cb

QUIT
QUITMASK
RELEASED
RESIZABLE
RLEACCEL
RLEACCELOK
RW_SEEK_CUR
RW_SEEK_END
RW_SEEK_SET
SRCALPHA
SRCCOLORKEY
SWSURFACE
SYSWMEVENT
SYSWMEVENTMASK
TIMER_RESOLUTION
TIMESLICE
UNSUPPORTED
USEREVENT
UYVY_OVERLAY
VIDEOEXPOSE
VIDEOEXPOSEMASK
VIDEORESIZE
VIDEORESIZEMASK
YUY2_OVERLAY
YV12_OVERLAY
YVYU_OVERLAY

Public Class Methods

AudioDriverName() click to toggle source
# 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
GL_GetAttribute( attrib ) click to toggle source
# File lib/ruby-sdl-ffi/sdl/video.rb, line 468
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
GetClipRect( surface ) click to toggle source
# File lib/ruby-sdl-ffi/sdl/video.rb, line 429
def self.GetClipRect( surface )
  mp = FFI::Buffer.new( Rect )
  __SDL_GetClipRect( surface, mp )
  return Rect.new( mp )
end
GetGammaRamp() click to toggle source
# File lib/ruby-sdl-ffi/sdl/video.rb, line 341
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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source

Returns [buttons, x, y].

buttons: buttons currently pressed (bitmask of BUTTON_*MASK constants).
x, y: current position of the mouse cursor.
# 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
GetRGB( uint32, format ) click to toggle source
# File lib/ruby-sdl-ffi/sdl/video.rb, line 367
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 ) click to toggle source
# File lib/ruby-sdl-ffi/sdl/video.rb, line 381
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
GetRelativeMouseState() click to toggle source

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.
# 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
LoadBMP( file ) click to toggle source
# File lib/ruby-sdl-ffi/sdl/video.rb, line 411
def self.LoadBMP( file )
  return LoadBMP_RW( RWFromFile( file, "rb" ), 1 )
end
PeepEvents( events, action, mask ) click to toggle source

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.
# File lib/ruby-sdl-ffi/sdl/event.rb, line 275
def self.PeepEvents( events, action, mask )
  # PeepEvents is very versatile, so we break it up into
  # different actions...

  case action

  # Append the given events to the queue, return number added.
  when ADDEVENT
    numevents = events.size
    mp = FFI::Buffer.new( SDL::Event, numevents )

    # Dump the events into the Buffer as raw, hardcore bytes
    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 )
    
  # Peek or Get the first N events and return them in an array.
  # Peek does not remove them from the queue, but Get does.
  when PEEKEVENT, GETEVENT
    numevents = events.to_i
    mp = FFI::Buffer.new( SDL::Event, numevents )
    n = __SDL_PeepEvents( mp, numevents, action, mask )

    # Something went wrong
    return nil if( n == -1 )

    events = []
    n.times do |i|
      events << Event.new( mp[i] ).unwrap
    end

    return events
  end
end
PollEvent() click to toggle source
# 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
SaveBMP( surface, file ) click to toggle source
# File lib/ruby-sdl-ffi/sdl/video.rb, line 415
def self.SaveBMP( surface, file )
  return SaveBMP_RW( surface, RWFromFile( file, "wb" ), 1 )
end
SetEventFilter( &block ) click to toggle source
# 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 ) click to toggle source
# File lib/ruby-sdl-ffi/sdl/video.rb, line 284
def self.SetVideoMode( *args )
  result = __SetVideoMode(*args)
  if defined? SDL::Mac
    SDL::Mac::HIServices.make_current_front
    SDL::Mac.make_menus("ruby")
  end
  return result
end
UpdateRects( surf, rects ) click to toggle source
# File lib/ruby-sdl-ffi/sdl/video.rb, line 318
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
WM_GetCaption() click to toggle source
# File lib/ruby-sdl-ffi/sdl/video.rb, line 491
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
WaitEvent() click to toggle source
# 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
sdl_func( name, args, ret ) click to toggle source
# 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 ) click to toggle source

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")
# File lib/ruby-sdl-ffi/sdl/video.rb, line 308
def self.set_app_name( app_name )
  if defined? SDL::Mac
    SDL::Mac.set_app_name( app_name )
  end
  nil
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.