class RbSDL2::RWOperator::WriteCallback

Public Class Methods

new(obj) click to toggle source
Calls superclass method
# File lib/rb_sdl2/rw_ops/rw_operator.rb, line 57
def initialize(obj)
  # size_t (* write) (struct SDL_RWops * context, const void *ptr, size_t size, size_t num);
  super(:size_t, [:pointer, :pointer, :size_t, :size_t]) do |_context, ptr, size, max_num|
    return 0 if ptr.null?
    obj.write(ptr.read_bytes(size * max_num)) / size rescue 0
  end
end