Module: Onsengame::Object::Base

Defined in:
lib/onsengame/object/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#xObject (readonly)

Returns the value of attribute x.



7
8
9
# File 'lib/onsengame/object/base.rb', line 7

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



7
8
9
# File 'lib/onsengame/object/base.rb', line 7

def y
  @y
end

Instance Method Details

#drawObject



26
27
# File 'lib/onsengame/object/base.rb', line 26

def draw
end

#draw_rectangle(x1, y1, x2, y2, color, z_order) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/onsengame/object/base.rb', line 29

def draw_rectangle(x1, y1, x2, y2, color, z_order)
  @window.draw_quad(x1, y1, color,
                    x2, y1, color,
                    x2, y2, color,
                    x1, y2, color,
                    z_order)
end

#initialize(window, x, y, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/onsengame/object/base.rb', line 8

def initialize(window, x, y, options={})
  @window = window
  @x = x
  @y = y
  @color = options[:color] || Gosu::Color::WHITE
  @z_order = options[:z_order] || ZOrder::OBJECT
  @font_name = options[:font_name] || "PressStart2P"
  @font_path = File.join(@window.options[:font_dir],
                         "#{@font_name}.ttf")
  @font_size = options[:font_size] || 24
  @font = Gosu::Font.new(@window,
                         @font_path,
                         @font_size)
end

#updateObject



23
24
# File 'lib/onsengame/object/base.rb', line 23

def update
end