Class: Doom::Wad::CompositeTexture

Inherits:
Object
  • Object
show all
Defined in:
lib/doom/wad/texture.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, width, height, columns) ⇒ CompositeTexture

Returns a new instance of CompositeTexture.



133
134
135
136
137
138
139
140
# File 'lib/doom/wad/texture.rb', line 133

def initialize(name, width, height, columns)
  @name = name
  @width = width
  @height = height
  @columns = columns
  @column_cache = Array.new(width)
  precompute_columns
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



131
132
133
# File 'lib/doom/wad/texture.rb', line 131

def columns
  @columns
end

#heightObject (readonly)

Returns the value of attribute height.



131
132
133
# File 'lib/doom/wad/texture.rb', line 131

def height
  @height
end

#nameObject (readonly)

Returns the value of attribute name.



131
132
133
# File 'lib/doom/wad/texture.rb', line 131

def name
  @name
end

#widthObject (readonly)

Returns the value of attribute width.



131
132
133
# File 'lib/doom/wad/texture.rb', line 131

def width
  @width
end

Instance Method Details

#column_pixels(x, _height_needed = nil) ⇒ Object



142
143
144
# File 'lib/doom/wad/texture.rb', line 142

def column_pixels(x, _height_needed = nil)
  @column_cache[x & (@width - 1)]
end