Devel-PerlySense
view release on metacpan or search on metacpan
t/data/project-lib/Game/Application.pm view on Meta::CPAN
=head2 runMain()
Run the Main menu, providing the user with e.g. options to
play.
Return 1 on success, else 0.
=cut
sub runMain { my $self = shift;
$self->oUI->runMainMenu($self);
return( 1 );
}
=head2 runGame()
t/data/project-lib/Game/UI.pm view on Meta::CPAN
$self->showScore(undef);
return(1);
}
=head2 runMainMenu($oApplication)
Show the menu and accept user input. Run whatever user
action is selected.
Return 1 on success, else 0.
=cut
sub runMainMenu { my $self = shift;
my ($oApplication) = @_;
my %hAction = (
"P" => sub {
$oApplication->runGame();
return(1);
},
"Q" => sub {
$self->oConsole->Cls();
return(0);
},
);
$self->showMainMenu() or return(0);
while(1) {
if(my $rcAction = $hAction{ uc($self->getKeyPressChar()) }) {
$rcAction->() or return(1);
$self->showMainMenu() or return(0);
}
sleep(0.05);
}
return(1);
}
=head2 showMainMenu()
Show the menu on the screen.
Return 1 on success, else 0.
=cut
sub showMainMenu { my $self = shift;
$self->oConsole->Cls();
my $text = qq{
.: MENU :. .: HOW TO PLAY :.
P - Play - F - Turn LEFT
Q - Quit - J - Turn RIGHT
( run in 0.653 second using v1.01-cache-2.11-cpan-49f99fa48dc )