Class: Nimo::TextRepresentation

Inherits:
ObjectRepresentation show all
Defined in:
lib/nimo/representations/text_representation.rb

Instance Attribute Summary collapse

Attributes inherited from ObjectRepresentation

#game_object, #game_window

Instance Method Summary collapse

Methods inherited from ObjectRepresentation

#act_upon, #always, #initialize, #listen_to, #update, #with_observer

Methods included from InputListener

#any_key, #button_down, #process_inputs, #when_key

Methods included from EventListener

#listen_to, #notify

Constructor Details

This class inherits a constructor from Nimo::ObjectRepresentation

Instance Attribute Details

#colorObject

Returns the value of attribute color.



5
6
7
# File 'lib/nimo/representations/text_representation.rb', line 5

def color
  @color
end

Instance Method Details

#drawObject



15
16
17
# File 'lib/nimo/representations/text_representation.rb', line 15

def draw
  @font.draw(@text, @game_object.x, @game_object.y, 0, 1, 1, @color)
end

#load(resources, params) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/nimo/representations/text_representation.rb', line 7

def load(resources, params)
  validate(params)
  
  @font = resources.font(params[:font])
  @color = params[:color]
  @text = params[:text] # TODO Or should it get it from the game_object?
end