a | b | |
---|
| 0 | + | class Term::Curses { |
---|
| 0 | + | has $.y is rw; |
---|
| 0 | + | has $.x is rw; |
---|
| 0 | + | |
---|
| 0 | + | has $!stdscr; |
---|
| 0 | + | |
---|
| 0 | + | method new( |
---|
| 0 | + | :$cbreak = True, |
---|
| 0 | + | :$echo = False, |
---|
| 0 | + | :$nl = False, |
---|
| 0 | + | :$intrflush = False, |
---|
| 0 | + | :$keypad = True, |
---|
| 0 | + | :$use_default_colors = True, |
---|
| 0 | + | :$start_color = True |
---|
| 0 | + | ) { |
---|
| 0 | + | #setlocale(0, ""); |
---|
| 0 | + | |
---|
| 0 | + | # TODO: use newterm() instead of initscr()? |
---|
| 0 | + | my $stdscr = initscr(); |
---|
| 0 | + | |
---|
| 0 | + | cbreak() if $cbreak; |
---|
| 0 | + | noecho() unless $echo; |
---|
| 0 | + | nonl() unless $nl; |
---|
| 0 | + | intrflush($stdscr, 0) unless $intrflush; |
---|
| 0 | + | keypad($stdscr, 1) if $keypad; |
---|
| 0 | + | if ($start_color and has_colors()) { |
---|
| 0 | + | use_default_colors() if $use_default_colors; |
---|
| 0 | + | start_color(); |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | self.bless(*, :$stdscr); |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | submethod BUILD(:$!stdscr) {} |
---|
... | |
---|