use Tk;
# use strict;

use CardPlay::Card;

my $w = MainWindow->new();

$w->title('Card Demonstration');
$w->iconname('Card');
# my @ARG = $w;

my $w_msg = $w->Label(-font => '-Adobe-Times-Medium-R-Normal-*-180-*-*-*-*-*-*', -wraplength => '4i',
             -justify => 'left', -text => 'Card Demonstratoin');
my $c = $w->Canvas(-relief => 'raised', -width => '450', -height => '300');
my $w_ok = $w->Button(-text => 'Quit', -width => 8, -command => ['destroy', $w]);
$w_msg->pack(-side => 'top', -fill => 'x');
$c->pack(-side => 'top', -fill => 'x');
$w_ok->pack(-side => 'bottom', -pady => '5');

CardPlay::Card->init(-main=>$w);
$x = 20;
$y = 20;
foreach $suit ( 's','h','c','d') {
    for($i=1;$i<14;$i++) {
    $tag = $suit.$i;
    $card{$tag} = CardPlay::Card->new(-canvas=>$c,-suit=>$suit,-number=>$i);
    $card{$tag}->display('-x'=>$x,'-y'=>$y,'-movable'=>1);
    $x+=10; 
    }
    $y += 40;
    $x = 20;
}
print STDOUT "initialzation done\n";
$w->update();

$w->MainLoop();

1;

# end