Class: SDL2::Rect

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/sdl2/rect.rb

Instance Method Summary collapse

Instance Method Details

#emptyObject



11
12
13
# File 'lib/sdl2/rect.rb', line 11

def empty
  return ((!self.null?) || (self[:w] <= 0) || (self[:h] <= 0)) ? :true : :false
end

#empty?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/sdl2/rect.rb', line 15

def empty?
  empty == :true
end

#equals(other) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/sdl2/rect.rb', line 19

def equals(other)
  if self.null or other.null?
    return (self.null? and other.null?) ? :true : :false
  else
    [:x, :y, :w, :h].each do |field|
      return :false unless self[field] == other[field]
    end
  end
  return true # if we made it this far
end