class RubyArena::Gui
Constants
- HEIGHT
- WIDTH
Attributes
arena[R]
robot_renderers[R]
Public Class Methods
new(arena)
click to toggle source
Calls superclass method
# File lib/ruby_arena/gui.rb, line 8 def initialize(arena) @arena = arena @_robot_renderers = {} @_bullet_renderers = {} super(width, height, false) end
Public Instance Methods
draw()
click to toggle source
# File lib/ruby_arena/gui.rb, line 19 def draw draw_robots draw_bullets end
update()
click to toggle source
# File lib/ruby_arena/gui.rb, line 15 def update arena.update end
Private Instance Methods
bullet_renderer(bullet)
click to toggle source
# File lib/ruby_arena/gui.rb, line 50 def bullet_renderer(bullet) @_bullet_renderers[bullet] ||= BulletRenderer.new(window: self, bullet: bullet) end
bullets()
click to toggle source
# File lib/ruby_arena/gui.rb, line 58 def bullets arena.bullets end
draw_bullets()
click to toggle source
# File lib/ruby_arena/gui.rb, line 40 def draw_bullets bullets.each do |bullet| bullet_renderer(bullet).draw end end
draw_robots()
click to toggle source
# File lib/ruby_arena/gui.rb, line 34 def draw_robots robots.each do |robot| robot_renderer(robot).draw end end
height()
click to toggle source
# File lib/ruby_arena/gui.rb, line 30 def height arena.height end
robot_renderer(robot)
click to toggle source
# File lib/ruby_arena/gui.rb, line 46 def robot_renderer(robot) @_robot_renderers[robot] ||= RobotRenderer.new(window: self, robot: robot) end
robots()
click to toggle source
# File lib/ruby_arena/gui.rb, line 54 def robots arena.robots end
width()
click to toggle source
# File lib/ruby_arena/gui.rb, line 26 def width arena.width end