Class: Doom::Wad::CompositeTexture
- Inherits:
-
Object
- Object
- Doom::Wad::CompositeTexture
- Defined in:
- lib/doom/wad/texture.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #column_pixels(x, height_needed = nil) ⇒ Object
-
#initialize(name, width, height, columns) ⇒ CompositeTexture
constructor
A new instance of CompositeTexture.
Constructor Details
#initialize(name, width, height, columns) ⇒ CompositeTexture
Returns a new instance of CompositeTexture.
140 141 142 143 144 145 |
# File 'lib/doom/wad/texture.rb', line 140 def initialize(name, width, height, columns) @name = name @width = width @height = height @columns = columns end |
Instance Attribute Details
#columns ⇒ Object (readonly)
Returns the value of attribute columns.
138 139 140 |
# File 'lib/doom/wad/texture.rb', line 138 def columns @columns end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
138 139 140 |
# File 'lib/doom/wad/texture.rb', line 138 def height @height end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
138 139 140 |
# File 'lib/doom/wad/texture.rb', line 138 def name @name end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
138 139 140 |
# File 'lib/doom/wad/texture.rb', line 138 def width @width end |
Instance Method Details
#column_pixels(x, height_needed = nil) ⇒ Object
147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/doom/wad/texture.rb', line 147 def column_pixels(x, height_needed = nil) x = x % @width posts = @columns[x] height_needed ||= @height pixels = Array.new(height_needed, 0) posts.each do |post| post.pixels.each_with_index do |color, i| y = (post.top_delta + i) % @height pixels[y] = color if y < height_needed end end pixels end |