Module: Lotu::Resourceful::InstanceMethods
- Defined in:
- lib/lotu/behaviors/resourceful.rb
Instance Method Summary collapse
- #image(name) ⇒ Object
- #init_behavior ⇒ Object
- #load_images(path) ⇒ Object
- #load_songs(path) ⇒ Object
- #load_sounds(path) ⇒ Object
- #song(name) ⇒ Object
- #sound(name) ⇒ Object
- #with_path(path, &blk) ⇒ Object
Instance Method Details
#image(name) ⇒ Object
15 16 17 |
# File 'lib/lotu/behaviors/resourceful.rb', line 15 def image(name) @_images[name] end |
#init_behavior ⇒ Object
9 10 11 12 13 |
# File 'lib/lotu/behaviors/resourceful.rb', line 9 def init_behavior @_images = {} @_sounds = {} @_songs = {} end |
#load_images(path) ⇒ Object
27 28 29 |
# File 'lib/lotu/behaviors/resourceful.rb', line 27 def load_images(path) load_resources(@_images, /\.png|\.jpg|\.bmp/, path, Gosu::Image) end |
#load_songs(path) ⇒ Object
35 36 37 |
# File 'lib/lotu/behaviors/resourceful.rb', line 35 def load_songs(path) load_resources(@_sounds, /\.ogg|\.mp3|\.wav/, path, Gosu::Song) end |
#load_sounds(path) ⇒ Object
31 32 33 |
# File 'lib/lotu/behaviors/resourceful.rb', line 31 def load_sounds(path) load_resources(@_sounds, /\.ogg|\.mp3|\.wav/, path, Gosu::Sample) end |
#song(name) ⇒ Object
23 24 25 |
# File 'lib/lotu/behaviors/resourceful.rb', line 23 def song(name) @_songs[name] end |
#sound(name) ⇒ Object
19 20 21 |
# File 'lib/lotu/behaviors/resourceful.rb', line 19 def sound(name) @_sounds[name] end |
#with_path(path, &blk) ⇒ Object
39 40 41 42 |
# File 'lib/lotu/behaviors/resourceful.rb', line 39 def with_path(path, &blk) @_path = File.(File.dirname path) yield end |