Class: RbSDL2::RWObject::CloseCallback
- Inherits:
-
FFI::Function
- Object
- FFI::Function
- RbSDL2::RWObject::CloseCallback
- Defined in:
- lib/rb_sdl2/rw_ops/rw_object.rb
Instance Method Summary collapse
-
#initialize ⇒ CloseCallback
constructor
A new instance of CloseCallback.
Constructor Details
#initialize ⇒ CloseCallback
Returns a new instance of CloseCallback.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rb_sdl2/rw_ops/rw_object.rb', line 4 def initialize # int (* close) (struct RWops * context); super(:int, [:pointer]) do |context| yield 0 rescue => e raise e if $DEBUG Error. = e. -1 ensure # SDL_RWclose() の仕様により成功、失敗問わずポインターを開放する。 ::SDL.FreeRW(context) end end |