Class: Doom::Wad::TextureManager
- Inherits:
-
Object
- Object
- Doom::Wad::TextureManager
- Defined in:
- lib/doom/wad/texture.rb
Instance Attribute Summary collapse
-
#patches ⇒ Object
readonly
Returns the value of attribute patches.
-
#pnames ⇒ Object
readonly
Returns the value of attribute pnames.
-
#textures ⇒ Object
readonly
Returns the value of attribute textures.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #get_patch(index) ⇒ Object
-
#initialize(wad) ⇒ TextureManager
constructor
A new instance of TextureManager.
Constructor Details
#initialize(wad) ⇒ TextureManager
86 87 88 89 90 91 92 93 |
# File 'lib/doom/wad/texture.rb', line 86 def initialize(wad) @wad = wad result = Texture.load_all(wad) @textures = result[:textures] @pnames = result[:pnames] @patches = {} @composite_cache = {} end |
Instance Attribute Details
#patches ⇒ Object (readonly)
Returns the value of attribute patches.
84 85 86 |
# File 'lib/doom/wad/texture.rb', line 84 def patches @patches end |
#pnames ⇒ Object (readonly)
Returns the value of attribute pnames.
84 85 86 |
# File 'lib/doom/wad/texture.rb', line 84 def pnames @pnames end |
#textures ⇒ Object (readonly)
Returns the value of attribute textures.
84 85 86 |
# File 'lib/doom/wad/texture.rb', line 84 def textures @textures end |
Instance Method Details
#[](name) ⇒ Object
95 96 97 98 99 |
# File 'lib/doom/wad/texture.rb', line 95 def [](name) return nil if name.nil? || name.empty? || name == '-' @composite_cache[name] ||= build_composite(name.upcase) end |
#get_patch(index) ⇒ Object
101 102 103 104 105 106 |
# File 'lib/doom/wad/texture.rb', line 101 def get_patch(index) name = @pnames[index] return nil unless name @patches[name] ||= Patch.load(@wad, name) end |