Class: Dedalus::ImageRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/dedalus/image_repository.rb

Class Method Summary collapse

Class Method Details

.lookup(path) ⇒ Object



3
4
5
6
7
# File 'lib/dedalus/image_repository.rb', line 3

def self.lookup(path)
  @images ||= {}
  @images[path] ||= Gosu::Image.new(path)
  @images[path]
end

.lookup_recording(id, width, height, window, force: false, &blk) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/dedalus/image_repository.rb', line 15

def self.lookup_recording(id,width,height,window,force:false,&blk)
  @recordings ||= {}
  if force
    @recordings[id] = window.record(width.to_i,height.to_i,&blk)
  else
    @recordings[id] ||= window.record(width.to_i,height.to_i,&blk)
  end
  @recordings[id]
end

.lookup_tiles(path, width, height) ⇒ Object



9
10
11
12
13
# File 'lib/dedalus/image_repository.rb', line 9

def self.lookup_tiles(path, width, height)
  @tiles ||= {}
  @tiles[path] ||= Gosu::Image::load_tiles(path, width.to_i, height.to_i)
  @tiles[path]
end