App-Tarotplane

 view release on metacpan or  search on metacpan

lib/App/Tarotplane/UI.pm  view on Meta::CPAN

    my $self = shift;

    doupdate();

}

sub draw_card {

    my $self = shift;
    my $str  = shift;
    my $bold = shift;

    # Make room for the box borders and a single whitespace on each side.
    my $linemax = getmaxx($self->{CardWin}) - 4;

    $self->{CardStr} = $str if defined $str;

    $columns = $linemax;
    my $text = wrap('', '', $self->{CardStr});

    if (defined $bold) {
        attrset($self->{CardWin}, $bold ? A_BOLD : A_NORMAL);
    }

    erase($self->{CardWin});
    box($self->{CardWin}, 0, 0);

    my $ypos = (getmaxy($self->{CardWin}) / 2) - (($text =~ tr/\n//) / 2);

    foreach my $l (split /\n/, $text) {
        $l =~ s/^\s+|\s+$//; # Trim leading/trailing whitespace.
        $l =~ s/\s+/ /g;     # Truncate space.

lib/App/Tarotplane/UI.pm  view on Meta::CPAN


=head2 $ui->wipe()

Wipes screen. Should be called before any re-drawing occurs.

=head2 $ui->update()

Updates screen with any new drawings. Should be called to display the results
of any draw method.

=head2 $ui->draw_card([$str, $bold])

Draws a new card displaying $str, automatically performing any text wrapping
necessary to fit in the card. If $bold is supplied and true, the drawn card
will be bold.

update() needs to be called to push the drawing to the screen.

If $str and/or $bold are not supplied, draw_card() 
will use whatever was used on a previous call to draw_card().

=head2 $ui->draw_info([$str])

Draws an info bar at the bottom of the screen containing $str.

update() needs to be called to push the drawing to the screen.

If $str is not supplied, uses the last string supplied by a previous
draw_info() call.



( run in 3.338 seconds using v1.01-cache-2.11-cpan-5c0b1e786e0 )