NAME

Games::Risk::Tk::Cards - cards listing

VERSION

version 4.000

DESCRIPTION

GR::Tk::Cards implements a POE session, creating a Tk window to list the cards the player got. It can be used to exchange cards with new armies during reinforcement.

METHODS

card_add

    $K->post( cards => 'card_add', $card );

Player just received a new $card, display it.

card_del

    $K->post( cards => 'card_del', @cards );

Player just exchanged some @cards, remove them.

attack

    $K->post( cards => 'attack' );

Prevent user to exchange armies.

place_armies

    $K->post( cards => 'place_armies' );

Change exchange button state depending on the cards selected.

shutdown

    $K->post( cards => 'shutdown', $destroy );

Kill current session. If $destroy is true, the toplevel window will also be destroyed.

visibility_toggle

    $K->post( 'gui-continents' => 'visibility_toggle' );

Request window to be hidden / shown depending on its previous state.

SYNOPSYS

    Games::Risk::Tk::Cards->new(%opts);

CLASS METHODS

my $id = Games::Risk::Tk::Cards->spawn( %opts );

Create a window listing player cards, and return the associated POE session ID. One can pass the following options:

parent => $mw

A Tk window that will be the parent of the toplevel window created. This parameter is mandatory.

PUBLIC EVENTS

The newly created POE session accepts the following events:

  • card_add( $card )

    Add $card to the list of cards owned by the player to be shown.

  • card_del( $card )

    Remove $card from the list of cards owned by the player to be shown.

  • visibility_toggle()

    Request window to be hidden / shown depending on its previous state.

SEE ALSO

Games::Risk.

AUTHOR

Jerome Quelin

COPYRIGHT AND LICENSE

This software is Copyright (c) 2008 by Jerome Quelin.

This is free software, licensed under:

  The GNU General Public License, Version 3, June 2007