Class: Dedalus::Elements::Icon

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

Instance Attribute Summary collapse

Attributes inherited from Image

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

Attributes inherited from Atom

#padding

Attributes inherited from Dedalus::Element

#background_color, #color, #height, #height_percent, #margin, #offset, #padding, #position, #shown, #width, #width_percent, #z_order

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Image

#asset, description, #dimensions, #height, #offset, #overlay_gosu_color, #render, #width

Methods inherited from Dedalus::Element

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

Constructor Details

This class inherits a constructor from Dedalus::Element

Instance Attribute Details

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

Class Method Details

.example_dataObject



14
15
16
# File 'lib/dedalus/elements/icon.rb', line 14

def self.example_data
  { name: 'house' }
end

.for(sym, attrs = {}) ⇒ Object



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

def for(sym, attrs={})
  new(attrs.merge(name: sym))
end

Instance Method Details

#pathObject



10
11
12
# File 'lib/dedalus/elements/icon.rb', line 10

def path
  @path ||= "media/icons/#{name}.png"
end

#scaleObject



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

def scale
  @scale ||= 0.062
end