Class: Sidedefs

Inherits:
DecodedLump show all
Defined in:
lib/ruby-doom.rb

Constant Summary collapse

BYTES_EACH =
30
NAME =
"SIDEDEFS"

Instance Attribute Summary

Attributes inherited from DecodedLump

#items

Attributes inherited from Lump

#name

Instance Method Summary collapse

Methods inherited from DecodedLump

#add, #write

Constructor Details

#initializeSidedefs

Returns a new instance of Sidedefs.



474
475
476
# File 'lib/ruby-doom.rb', line 474

def initialize
  super(NAME)
end

Instance Method Details

#read(bytes) ⇒ Object



477
478
479
480
481
482
483
# File 'lib/ruby-doom.rb', line 477

def read(bytes)
  (bytes.size / BYTES_EACH).times {|index|
    s = Sidedef.new
    s.read(bytes.slice(index*BYTES_EACH, BYTES_EACH))
    @items << s
  }
end

#sizeObject



484
485
486
# File 'lib/ruby-doom.rb', line 484

def size
  @items.size * BYTES_EACH
end