Module: Frusdl::Wrap

Included in:
SDL::PixelFormat, SDL::Screen, SDL::VideoInfo
Defined in:
lib/frusdl/wrap.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



42
43
44
45
# File 'lib/frusdl/wrap.rb', line 42

def self.included(base)
  base.extend(Frusdl::Wrap::ClassMethods)
  # Also extend with class methods
end

Instance Method Details

#initialize_pointer(ptr, klass) ⇒ Object

Initializes the pointer and struct members



33
34
35
36
37
38
39
40
# File 'lib/frusdl/wrap.rb', line 33

def initialize_pointer(ptr, klass)
  @pointer = ptr
  @struct  = klass.new(ptr)
  # define an accessor when this is called
  unless self.respond_to? :pointer 
    self.klass.attr_reader(:pointer)
  end  
end