Sha256: 370288e669ef012ab7d4077ae6442a94fe57bfccf838776d9eedfc9629068e0c

Contents?: true

Size: 536 Bytes

Versions: 9

Compression:

Stored size: 536 Bytes

Contents

# Holds the things that are drawn.
#
class Sprites
  
  def initialize elements = []
    @elements = elements
    @to_remove = []
  end
  
  def register element
    @elements << element
  end
  def registered? element
    @elements.include? element
  end
  
  def move
    @elements.each &:move
  end
  
  def draw
    @elements.each &:draw
  end
  
  def remove object
    @to_remove << object
  end
  
  #
  #
  def remove_marked
    @to_remove.each do |object|
      @elements.delete object
    end
    @to_remove.clear
  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gosu_extensions-0.3.8 lib/core/sprites.rb
gosu_extensions-0.3.7 lib/core/sprites.rb
gosu_extensions-0.3.6 lib/core/sprites.rb
gosu_extensions-0.3.5 lib/core/sprites.rb
gosu_extensions-0.3.4 lib/core/sprites.rb
gosu_extensions-0.3.3 lib/core/sprites.rb
gosu_extensions-0.3.2 lib/core/sprites.rb
gosu_extensions-0.3.1 lib/core/sprites.rb
gosu_extensions-0.3.0 lib/core/sprites.rb