class RubyArena::BulletRenderer

Attributes

bullet[R]
window[R]

Public Class Methods

new(args) click to toggle source
# File lib/ruby_arena/bullet_renderer.rb, line 5
def initialize(args)
  @bullet = args.fetch(:bullet)
  @window = args.fetch(:window)
end

Public Instance Methods

draw() click to toggle source
# File lib/ruby_arena/bullet_renderer.rb, line 10
def draw
  window.draw_quad(
    x1, y1, color,
    x1, y2, color,
    x2, y2, color,
    x2, y1, color
  )
end

Private Instance Methods

color() click to toggle source
# File lib/ruby_arena/bullet_renderer.rb, line 45
def color
  Gosu::Color::YELLOW
end
size() click to toggle source
# File lib/ruby_arena/bullet_renderer.rb, line 49
def size
  bullet.size
end
x() click to toggle source
# File lib/ruby_arena/bullet_renderer.rb, line 37
def x
  bullet.x
end
x1() click to toggle source
# File lib/ruby_arena/bullet_renderer.rb, line 21
def x1
  x - size/2
end
x2() click to toggle source
# File lib/ruby_arena/bullet_renderer.rb, line 25
def x2
  x + size/2
end
y() click to toggle source
# File lib/ruby_arena/bullet_renderer.rb, line 41
def y
  bullet.y
end
y1() click to toggle source
# File lib/ruby_arena/bullet_renderer.rb, line 29
def y1
  y - size/2
end
y2() click to toggle source
# File lib/ruby_arena/bullet_renderer.rb, line 33
def y2
  y + size/2
end