Class: Upwords::Graphics
- Inherits:
-
Curses::Window
- Object
- Curses::Window
- Upwords::Graphics
- Defined in:
- lib/upwords/graphics.rb
Instance Method Summary collapse
- #hide_rack ⇒ Object
-
#initialize(game) ⇒ Graphics
constructor
A new instance of Graphics.
- #message=(new_message) ⇒ Object
- #refresh ⇒ Object
- #show_rack ⇒ Object
- #to_s ⇒ Object
- #toggle_rack_visibility ⇒ Object
Constructor Details
#initialize(game) ⇒ Graphics
Returns a new instance of Graphics.
6 7 8 9 10 11 12 13 |
# File 'lib/upwords/graphics.rb', line 6 def initialize(game) super(0,0,0,0) @game = game @board = @game.board @cursor = @game.cursor @message = '' @rack_visibility = false end |
Instance Method Details
#hide_rack ⇒ Object
39 40 41 |
# File 'lib/upwords/graphics.rb', line 39 def hide_rack @rack_visibility = false end |
#message=(new_message) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/upwords/graphics.rb', line 27 def () if .nil? @message = "" else @message = end end |
#refresh ⇒ Object
15 16 17 18 19 |
# File 'lib/upwords/graphics.rb', line 15 def refresh clear self << self.to_s super end |
#show_rack ⇒ Object
35 36 37 |
# File 'lib/upwords/graphics.rb', line 35 def show_rack @rack_visibility = true end |
#to_s ⇒ Object
21 22 23 24 25 |
# File 'lib/upwords/graphics.rb', line 21 def to_s (draw_board + ).zip(draw_stats).map do |board_row, stats_row| (board_row.to_s) + (stats_row.to_s) end.join("\n") end |
#toggle_rack_visibility ⇒ Object
43 44 45 |
# File 'lib/upwords/graphics.rb', line 43 def toggle_rack_visibility @rack_visibility = !@rack_visibility end |