Class: GBTiles::GBR::TileSet::Objects::Palettes

Inherits:
GBTiles::GBR::TileSet::Object show all
Defined in:
lib/gbtiles/gbr/tile_set/objects/palettes.rb

Instance Attribute Summary collapse

Attributes inherited from GBTiles::GBR::TileSet::Object

#object_id, #object_type

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePalettes

Returns a new instance of Palettes.



13
14
15
# File 'lib/gbtiles/gbr/tile_set/objects/palettes.rb', line 13

def initialize
  super GBTiles::GBR::TileSet::OBJECT_TYPE[:palettes]
end

Instance Attribute Details

#colorsObject

Returns the value of attribute colors.



9
10
11
# File 'lib/gbtiles/gbr/tile_set/objects/palettes.rb', line 9

def colors
  @colors
end

#countObject

Returns the value of attribute count.



8
9
10
# File 'lib/gbtiles/gbr/tile_set/objects/palettes.rb', line 8

def count
  @count
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/gbtiles/gbr/tile_set/objects/palettes.rb', line 7

def id
  @id
end

#sgb_colorsObject

Returns the value of attribute sgb_colors.



11
12
13
# File 'lib/gbtiles/gbr/tile_set/objects/palettes.rb', line 11

def sgb_colors
  @sgb_colors
end

#sgb_countObject

Returns the value of attribute sgb_count.



10
11
12
# File 'lib/gbtiles/gbr/tile_set/objects/palettes.rb', line 10

def sgb_count
  @sgb_count
end

Class Method Details

.initFromBitString(src) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/gbtiles/gbr/tile_set/objects/palettes.rb', line 17

def self.initFromBitString src
  object = GBTiles::GBR::TileSet::Objects::Palettes.new

  object.id         = GBTiles::DataType.word!(src)
  object.count      = GBTiles::DataType.word!(src)
  object.colors     = src.slice!(0, object.count)
  object.sgb_count  = GBTiles::DataType.word!(src)
  object.sgb_colors = src.slice!(0, object.sgb_count)

  object
end