class TermWindow

Constants

DEFAULT_HEIGHT
DEFAULT_WIDTH

Attributes

height[RW]
width[RW]

Public Class Methods

new(height = DEFAULT_HEIGHT, width = DEFAULT_WIDTH) click to toggle source
Calls superclass method
# File lib/snake_game/term_window.rb, line 9
def initialize(height = DEFAULT_HEIGHT, width = DEFAULT_WIDTH)
  super(height, width, 0, 0)
  @width, @height = width, height
  self.box(?|, ?-)
  self.keypad(true)
end

Public Instance Methods

paint_food(food) click to toggle source
# File lib/snake_game/term_window.rb, line 16
def paint_food(food)
  self.setpos(food.y, food.x)
  self.addstr(food.symbol)
  self.refresh
end
paint_snake(snake) click to toggle source
# File lib/snake_game/term_window.rb, line 22
def paint_snake(snake)
  self.setpos(snake[0][1], snake[0][0])
  self.addstr(Snake::SYMBOL)
  self.refresh
end