Class: RbSDL2::RWObject::SeekCallback

Inherits:
FFI::Function
  • Object
show all
Defined in:
lib/rb_sdl2/rw_ops/rw_object.rb

Instance Method Summary collapse

Constructor Details

#initializeSeekCallback

Returns a new instance of SeekCallback.



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/rb_sdl2/rw_ops/rw_object.rb', line 42

def initialize
  # Sint64 (* seek) (struct RWops * context, Sint64 offset, int whence);
  super(:int64, [:pointer, :int64, :int]) do |_context, offset, whence|
    # SDL_RWseek() の仕様によりシーク後の現在位置を戻す必要がある。
    yield(offset, whence)
  rescue => e
    raise e if $DEBUG
    Error.last_error_message = e.message
    -1
  end
end