Module: Lotu::ResourceManager
- Defined in:
- lib/lotu/behaviors/resource_manager.rb
Instance Attribute Summary collapse
-
#animations ⇒ Object
Returns the value of attribute animations.
-
#default_font ⇒ Object
Returns the value of attribute default_font.
-
#images ⇒ Object
Returns the value of attribute images.
-
#songs ⇒ Object
Returns the value of attribute songs.
-
#sounds ⇒ Object
Returns the value of attribute sounds.
Instance Method Summary collapse
- #animation(name) ⇒ Object
-
#image(name) ⇒ Object
TODO: cambiar a Image.
- #init_behavior(opts) ⇒ Object
- #song(name) ⇒ Object
- #sound(name) ⇒ Object
- #with_path_from_file(path, &blk) ⇒ Object
Instance Attribute Details
#animations ⇒ Object
Returns the value of attribute animations.
4 5 6 |
# File 'lib/lotu/behaviors/resource_manager.rb', line 4 def animations @animations end |
#default_font ⇒ Object
Returns the value of attribute default_font.
4 5 6 |
# File 'lib/lotu/behaviors/resource_manager.rb', line 4 def default_font @default_font end |
#images ⇒ Object
Returns the value of attribute images.
4 5 6 |
# File 'lib/lotu/behaviors/resource_manager.rb', line 4 def images @images end |
#songs ⇒ Object
Returns the value of attribute songs.
4 5 6 |
# File 'lib/lotu/behaviors/resource_manager.rb', line 4 def songs @songs end |
#sounds ⇒ Object
Returns the value of attribute sounds.
4 5 6 |
# File 'lib/lotu/behaviors/resource_manager.rb', line 4 def sounds @sounds end |
Instance Method Details
#animation(name) ⇒ Object
28 29 30 |
# File 'lib/lotu/behaviors/resource_manager.rb', line 28 def animation(name) @animations[name] end |
#image(name) ⇒ Object
TODO: cambiar a Image
16 17 18 |
# File 'lib/lotu/behaviors/resource_manager.rb', line 16 def image( name ) @images[name] end |
#init_behavior(opts) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/lotu/behaviors/resource_manager.rb', line 6 def init_behavior opts super if defined? super @images = {} @sounds = {} @songs = {} @animations = Hash.new{ |h,k| h[k] = [] } @default_font = Hash.new{ |h,k| h[k] = Gosu::Font.new( self, Gosu::default_font_name, k ) } end |
#song(name) ⇒ Object
24 25 26 |
# File 'lib/lotu/behaviors/resource_manager.rb', line 24 def song( name ) @songs[name] end |
#sound(name) ⇒ Object
20 21 22 |
# File 'lib/lotu/behaviors/resource_manager.rb', line 20 def sound( name ) @sounds[name] end |
#with_path_from_file(path, &blk) ⇒ Object
32 33 34 35 |
# File 'lib/lotu/behaviors/resource_manager.rb', line 32 def with_path_from_file(path, &blk) @path = File.(File.dirname path) instance_eval &blk end |