Class: Dedalus::Elements::Sprite

Inherits:
Image show all
Defined in:
lib/dedalus/elements/sprite.rb

Instance Attribute Summary collapse

Attributes inherited from Image

#invert_x, #invert_y, #overlay_color, #padding, #path, #z_order

Attributes inherited from Atom

#padding, #scale

Attributes inherited from Dedalus::Element

#background_color, #color, #height_percent, #margin, #padding, #position, #width_percent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Image

#dimensions, #offset, #overlay_gosu_color, #render, #scale

Methods inherited from Dedalus::Element

#big_font, #code_font, #draw_bounding_box, #font, #huge_font, #initialize, #tiny_font, #view, #window

Constructor Details

This class inherits a constructor from Dedalus::Element

Instance Attribute Details

#frameObject

Returns the value of attribute frame.



4
5
6
# File 'lib/dedalus/elements/sprite.rb', line 4

def frame
  @frame
end

#heightObject

Returns the value of attribute height.



4
5
6
# File 'lib/dedalus/elements/sprite.rb', line 4

def height
  @height
end

#widthObject

Returns the value of attribute width.



4
5
6
# File 'lib/dedalus/elements/sprite.rb', line 4

def width
  @width
end

Class Method Details

.descriptionObject



19
20
21
# File 'lib/dedalus/elements/sprite.rb', line 19

def self.description
  "an animated image"
end

.example_dataObject



10
11
12
13
14
15
16
17
# File 'lib/dedalus/elements/sprite.rb', line 10

def self.example_data
  {
    path: "media/images/tiles.png",
    frame: 3,
    width: 64,
    height: 64
  }
end

Instance Method Details

#assetObject



6
7
8
# File 'lib/dedalus/elements/sprite.rb', line 6

def asset
  @asset ||= Dedalus::ImageRepository.lookup_tiles(path, width, height)[frame]
end