NAME

App::Tarotplane::UI - tarotplane TUI

SYNOPSIS

use App::Tarotplane::UI;

$ui = App::Tarotplane::UI->init();

$ui->draw_card($cardstr);
$ui->draw_info($infostr);
$ui->update();

$cmd = $ui->poll();

$ui->wipe();
$ui->update();

$ui->end();

DESCRIPTION

App::Tarotplane::UI is the component of tarotplane that handles the TUI (text-user interface). It accomplishes this through the Curses module. If you're looking for documentation for tarotplane, consult its manual page.

Object Methods

App::Tarotplane::UI->init()

Initializes Curses and returns an App::Tarotplane::UI object. Only one App::Tarotplane::UI object can be initialized at a single time.

$ui->wipe()

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

$ui->update()

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

$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().

$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.

$ui->draw_help()

Wipes screen and draws help message.

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

$ui->update_size()

Resizes drawings to fit screen, automatically performing necessary wiping and updating.

$ui->poll()

Returns command from user input, or undef if the command does not exist. See the documentation for %KEY_BINDINGS for a list of valid commands.

$ui->end()

Ends Curses.

Global Variables

%KEY_BINDINGS

Hash map of commands and their respective key bindings.

AUTHOR

Written by Samuel Young <samyoung12788@gmail.com>.

COPYRIGHT

Copyright 2024, Samuel Young

This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

tarotplane, Curses