Class: Rutt::Screen::Base
- Inherits:
-
Object
- Object
- Rutt::Screen::Base
- Defined in:
- lib/rutt/screen.rb
Instance Method Summary collapse
- #decr_page ⇒ Object
- #display_menu ⇒ Object
- #incr_page ⇒ Object
-
#initialize(stdscr) ⇒ Base
constructor
A new instance of Base.
- #move_pointer(pos, move_to = false) ⇒ Object
Constructor Details
#initialize(stdscr) ⇒ Base
Returns a new instance of Base.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/rutt/screen.rb', line 4 def initialize(stdscr) @stdscr = stdscr @min_y = 1 @max_y = @stdscr.getmaxy - 5 @cur_y = 1 @cur_x = 0 @pages = [] @cur_page = 0 end |
Instance Method Details
#decr_page ⇒ Object
23 24 25 26 |
# File 'lib/rutt/screen.rb', line 23 def decr_page @cur_page -= 1 @cur_page = 0 if @cur_page < 0 end |
#display_menu ⇒ Object
28 29 30 31 32 |
# File 'lib/rutt/screen.rb', line 28 def @stdscr.clear @stdscr.move(0, 0) @stdscr.addstr(" rutt #{@menu}\n") end |
#incr_page ⇒ Object
17 18 19 20 21 |
# File 'lib/rutt/screen.rb', line 17 def incr_page check_page = @cur_page + 1 check_page = @cur_page if check_page >= @pages.length @cur_page = check_page end |
#move_pointer(pos, move_to = false) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rutt/screen.rb', line 34 def move_pointer(pos, move_to=false) @stdscr.move(@cur_y, 0) @stdscr.addstr(" ") if move_to == true @cur_y = pos else @cur_y += pos end @stdscr.move(@cur_y, 0) @stdscr.addstr(">") end |