Class: RbSDL2::Rect

Inherits:
Object
  • Object
show all
Defined in:
lib/rb_sdl2/rect.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x = 0, y = 0, w = 0, h = 0) ⇒ Rect

Returns a new instance of Rect.



9
10
11
12
# File 'lib/rb_sdl2/rect.rb', line 9

def initialize(x = 0, y = 0, w = 0, h = 0)
  @st = ::SDL::Rect.new
  @st[:x], @st[:y], @st[:w], @st[:h] = x, y, w, h
end

Class Method Details

.to_ary(ptr) ⇒ Object



4
5
6
# File 'lib/rb_sdl2/rect.rb', line 4

def to_ary(ptr)
  ::SDL::Rect.new(ptr).values
end

Instance Method Details

#to_aObject Also known as: to_ary



14
# File 'lib/rb_sdl2/rect.rb', line 14

def to_a = @st.values

#to_ptrObject



18
# File 'lib/rb_sdl2/rect.rb', line 18

def to_ptr = @st.to_ptr