module Snowy::Extentions

Public Instance Methods

clamp(min, max) click to toggle source
# File lib/snowy/common.rb, line 7
def clamp(min, max)
  case
  when self < min
    return min
  when self > max
    return max
  else
    return self
  end
end
get_alpha() click to toggle source
# File lib/snowy/common.rb, line 33
def get_alpha
  0xff & self
end
get_blue() click to toggle source
# File lib/snowy/common.rb, line 29
def get_blue
  0xff & (self >> 8)
end
get_green() click to toggle source
# File lib/snowy/common.rb, line 25
def get_green
  0xff & (self >> 16)
end
get_red() click to toggle source
# File lib/snowy/common.rb, line 21
def get_red
  0xff & (self >> 24)
end
pack_rgb() click to toggle source
# File lib/snowy/common.rb, line 37
def pack_rgb
  [self >> 24, self >> 16, self >> 8].pack("C3")
end
pack_rgba() click to toggle source
# File lib/snowy/common.rb, line 41
def pack_rgba
  [self].pack("N")
end