lib/units/thing.rb in gosu_extensions-0.1.11 vs lib/units/thing.rb in gosu_extensions-0.1.12
- old
+ new
@@ -2,12 +2,13 @@
include VectorUtilities
include InitializerHooks
include ItIsA
- # TODO Move this.
+ # TODO Move these.
#
+ # it_is Imageable
it_is Moveable
attr_writer :layer
attr_reader :window, :shape
@@ -24,30 +25,9 @@
def layer
@layer || Layer::Players
end
class << self
-
- # TODO Move to module.
- #
- def image path, *args
- InitializerHooks.register self do
- @image = Gosu::Image.new self.window, File.join(Resources.root, path), *args
- end
- define_method :image do
- @image
- end
- end
- def sequenced_image path, width, height, frequency = 10, &block
- InitializerHooks.register self do
- @image_sequence_started = Time.now
- @image = Gosu::Image::load_tiles self.window, File.join(Resources.root, path), width, height, false
- end
- # divider = 1000 / frequency
- define_method :image do
- @image[(block ? block : lambda { (Time.now - @image_sequence_started)*frequency % @image.size })[]]
- end
- end
@@form_shape_class_mapping = { :circle => CP::Shape::Circle }
def shape form
form_shape_class_mapping = @@form_shape_class_mapping
InitializerHooks.append self do
shape_class = form_shape_class_mapping[form]
\ No newline at end of file