Class: Nimo::QuadRepresentation

Inherits:
ObjectRepresentation show all
Defined in:
lib/nimo/representations/quad_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/quad_representation.rb', line 5

def color
  @color
end

Instance Method Details

#drawObject



13
14
15
16
17
18
19
# File 'lib/nimo/representations/quad_representation.rb', line 13

def draw
  @game_window.draw_quad(
    @game_object.x, @game_object.y, @color, 
    @game_object.x + @game_object.width, @game_object.y, @color,
    @game_object.x, @game_object.y + @game_object.height, @color,
    @game_object.x + @game_object.width, @game_object.y + @game_object.height, @color)
end

#load(resources, params) ⇒ Object



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

def load(resources, params)
  raise "Must provide :color param for quad loading" unless params.has_key?(:color)
  
  @color = params[:color]      
end