Class: Cliptic::Screen
Class Method Summary collapse
- .clear ⇒ Object
- .init_curses ⇒ Object
- .redraw(cb: nil) ⇒ Object
- .set_colors ⇒ Object
- .setup ⇒ Object
- .too_small? ⇒ Boolean
Class Method Details
.clear ⇒ Object
31 32 33 34 |
# File 'lib/cliptic.rb', line 31 def self.clear stdscr.clear stdscr.refresh end |
.init_curses ⇒ Object
17 18 19 20 21 22 |
# File 'lib/cliptic.rb', line 17 def self.init_curses init_screen raw noecho curs_set(0) end |
.redraw(cb: nil) ⇒ Object
38 39 40 41 42 |
# File 'lib/cliptic.rb', line 38 def self.redraw(cb:nil) Interface::Resizer.new.show if Screen.too_small? Screen.clear cb.call if cb end |
.set_colors ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/cliptic.rb', line 23 def self.set_colors start_color use_default_colors 1.upto(8) do |i| init_pair(i, i, -1) init_pair(i+8, 0, i) end end |
.setup ⇒ Object
12 13 14 15 16 |
# File 'lib/cliptic.rb', line 12 def self.setup init_curses set_colors if has_colors? redraw end |
.too_small? ⇒ Boolean
35 36 37 |
# File 'lib/cliptic.rb', line 35 def self.too_small? lines < 36 || cols < 61 end |