Module: Lotu::ResourceManager

Defined in:
lib/lotu/behaviors/resource_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#animationsObject

Returns the value of attribute animations.



4
5
6
# File 'lib/lotu/behaviors/resource_manager.rb', line 4

def animations
  @animations
end

#default_fontObject

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

#imagesObject

Returns the value of attribute images.



4
5
6
# File 'lib/lotu/behaviors/resource_manager.rb', line 4

def images
  @images
end

#songsObject

Returns the value of attribute songs.



4
5
6
# File 'lib/lotu/behaviors/resource_manager.rb', line 4

def songs
  @songs
end

#soundsObject

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.expand_path(File.dirname path)
  instance_eval &blk
end