Class: Rong::Client::DrawableElement

Inherits:
Object
  • Object
show all
Defined in:
lib/rong/client/drawable_element.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(window, element, color = Gosu::Color::WHITE, z_index = Window::ZIndex::FOREGROUND) ⇒ DrawableElement

Returns a new instance of DrawableElement.



6
7
8
9
10
11
# File 'lib/rong/client/drawable_element.rb', line 6

def initialize(window, element, color = Gosu::Color::WHITE, z_index = Window::ZIndex::FOREGROUND)
  @window  = window
  @element = element
  @color   = color
  @z_index = z_index
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



4
5
6
# File 'lib/rong/client/drawable_element.rb', line 4

def color
  @color
end

#elementObject (readonly)

Returns the value of attribute element.



4
5
6
# File 'lib/rong/client/drawable_element.rb', line 4

def element
  @element
end

#windowObject (readonly)

Returns the value of attribute window.



4
5
6
# File 'lib/rong/client/drawable_element.rb', line 4

def window
  @window
end

#z_indexObject (readonly)

Returns the value of attribute z_index.



4
5
6
# File 'lib/rong/client/drawable_element.rb', line 4

def z_index
  @z_index
end

Instance Method Details

#drawObject



13
14
15
16
17
18
19
# File 'lib/rong/client/drawable_element.rb', line 13

def draw
  window.draw_quad(element.left,  element.top,    color,
                   element.left,  element.bottom, color,
                   element.right, element.bottom, color,
                   element.right, element.top,    color,
                   z_index)
end