Class: RbSDL2::Event::EventPointer

Inherits:
FFI::AutoPointer
  • Object
show all
Defined in:
lib/rb_sdl2/event.rb

Class Method Summary collapse

Class Method Details

.mallocObject

Raises:

  • (NoMemoryError)


5
6
7
8
9
# File 'lib/rb_sdl2/event.rb', line 5

def malloc
  ptr = new(::SDL2.SDL_calloc(1, ::SDL2::SDL_Event.size))
  raise NoMemoryError if ptr.null?
  ptr
end

.release(ptr) ⇒ Object



11
12
13
14
15
# File 'lib/rb_sdl2/event.rb', line 11

def release(ptr)
  # メンバーのポインターを開放する。

  Event.to_ptr(ptr).clear
  ::SDL2.SDL_free(ptr)
end