SDL_active.h
sdl_func :GetEventFilter, [ ], :eventfilter_cb
# 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
# 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
# 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
# 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
# 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
# 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
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
# 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
# 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
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
# File lib/ruby-sdl-ffi/sdl/video.rb, line 411 def self.LoadBMP( file ) return LoadBMP_RW( RWFromFile( file, "rb" ), 1 ) end
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
# 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
# File lib/ruby-sdl-ffi/sdl/video.rb, line 415 def self.SaveBMP( surface, file ) return SaveBMP_RW( surface, RWFromFile( file, "wb" ), 1 ) end
# 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
# 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
# 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
# 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
# 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
# File lib/ruby-sdl-ffi/sdl.rb, line 53 def self.sdl_func( name, args, ret ) func name, "SDL_#{name}", args, ret end
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
Generated with the Darkfish Rdoc Generator 2.