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



27
28
29
# File 'lib/lotu/behaviors/resource_manager.rb', line 27

def animation(name)
  @animations[name]
end

#image(name) ⇒ Object



15
16
17
# File 'lib/lotu/behaviors/resource_manager.rb', line 15

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



23
24
25
# File 'lib/lotu/behaviors/resource_manager.rb', line 23

def song( name )
  @songs[name]
end

#sound(name) ⇒ Object



19
20
21
# File 'lib/lotu/behaviors/resource_manager.rb', line 19

def sound( name )
  @sounds[name]
end

#with_path_from_file(path, &blk) ⇒ Object



31
32
33
34
# File 'lib/lotu/behaviors/resource_manager.rb', line 31

def with_path_from_file(path, &blk)
  @path = File.expand_path(File.dirname path)
  instance_eval &blk
end