Class: Color

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bytes, g = nil, b = nil) ⇒ Color

Returns a new instance of Color.



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/RGSS.rb', line 75

def initialize(bytes, g = nil, b = nil)
  # massive hack to support triple param color
  if g && b
    @r = bytes
    @g = g
    @b = b
    @a = 255
  else
    @r, @g, @b, @a = *bytes.unpack('D4')
  end
end

Class Method Details

._load(bytes) ⇒ Object



91
92
93
# File 'lib/RGSS.rb', line 91

def self._load(bytes)
  Color.new(bytes)
end

Instance Method Details

#_dump(*ignored) ⇒ Object



87
88
89
# File 'lib/RGSS.rb', line 87

def _dump(*ignored)
  return [@r, @g, @b, @a].pack('D4')
end