Class: RubySnake::UI::Base
- Inherits:
-
Object
- Object
- RubySnake::UI::Base
- Defined in:
- lib/ruby_snake/ui/base.rb
Class Method Summary collapse
- .clear_tail ⇒ Object
- .display(stuff, symbol) ⇒ Object
- .draw_dialog(x, y, text) ⇒ Object
- .draw_food ⇒ Object
- .draw_snake ⇒ Object
Class Method Details
.clear_tail ⇒ Object
15 16 17 |
# File 'lib/ruby_snake/ui/base.rb', line 15 def clear_tail display snake.tail, ' ' end |
.display(stuff, symbol) ⇒ Object
9 10 11 12 13 |
# File 'lib/ruby_snake/ui/base.rb', line 9 def display stuff, symbol x = stuff.last + 1 y = stuff.first + 1 window.mvprintw x, y, symbol end |
.draw_dialog(x, y, text) ⇒ Object
5 6 7 |
# File 'lib/ruby_snake/ui/base.rb', line 5 def draw_dialog x, y, text UI.draw_dialog x, y, text end |
.draw_food ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/ruby_snake/ui/base.rb', line 19 def draw_food if Game.pause? window.color_set 3, nil else window.color_set 1, nil end display snake.food, '$' end |
.draw_snake ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/ruby_snake/ui/base.rb', line 28 def draw_snake snake.body.each do |body| if body == snake.head display body, '@' else display body, 'o' end end end |