Class: SFML::C::Window::Event

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/sfml/c/window.rb

Overview

sfEvent is a C union. The largest variant (KeyEvent on x86_64: 4+4+4+4

20 bytes) defines the union size; we allocate a buffer that big and

reinterpret per-type. We use a Struct (not Union) here because Ruby FFI handles variable-tag unions awkwardly — the tag is the first int32 in every variant, so we read it directly.

Instance Method Summary collapse

Instance Method Details

#event_typeObject



115
116
117
# File 'lib/sfml/c/window.rb', line 115

def event_type
  EVENT_TYPES[self[:type]]
end