Class: Xudoku::Cli::Screens::Menu

Inherits:
Base
  • Object
show all
Defined in:
lib/xudoku/cli/screens/menu.rb

Overview

:nodoc:

Constant Summary collapse

TOP_PADDING =
2
5
10
SELECTED =
""
NEW_PUZZLE =
"New puzzle"
QUIT =
"Quit"
HEADING =
"Xudoku"
[
  NEW_PUZZLE,
  QUIT
].freeze

Constants inherited from Base

Base::TITLE, Base::TITLE_HEIGHT

Instance Attribute Summary collapse

Attributes inherited from Base

#app, #first_render, #io, #reader

Instance Method Summary collapse

Methods inherited from Base

#initialize, #redraw!, #render

Constructor Details

This class inherits a constructor from Xudoku::Cli::Screens::Base

Instance Attribute Details

#heading_textObject (readonly)

Returns the value of attribute heading_text.



25
26
27
# File 'lib/xudoku/cli/screens/menu.rb', line 25

def heading_text
  @heading_text
end

#selected_indexObject (readonly)

Returns the value of attribute selected_index.



25
26
27
# File 'lib/xudoku/cli/screens/menu.rb', line 25

def selected_index
  @selected_index
end

Instance Method Details

#paint_screen(event = nil) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/xudoku/cli/screens/menu.rb', line 32

def paint_screen(event = nil)
  handle_event(event) unless event.nil?

  render_heading if first_render?

  render_puzzle_menu
  hide_cursor
  move_cursor_to_corner
end

#setupObject



27
28
29
30
# File 'lib/xudoku/cli/screens/menu.rb', line 27

def setup
  @selected_index = 0
  @heading_text   = Artii::Base.new.asciify(HEADING)
end