El código
Using perl Syntax Highlighting
- [
- #!usr/bin/perl
- #ASCII Art 0.1
- #Version Tk
- #Coded By Doddy H
- #Thanks to : reLlene,MARKO,explorer
- use Tk;
- use Tk::Dialog;
- use List::Util "max";
- if ( $^O eq 'MSWin32' ) {
- use Win32::Console;
- Win32::Console::Free();
- }
- my %letras = (
- a => "
- @
- @
- @ @
- @ @
- @ @
- @ @
- @@@@@
- @ @
- @ @
- ",
- b => "
- @@@@
- @ @
- @ @
- @ @
- @@@@
- @ @
- @ @
- @ @
- @@@@
- ",
- c => "
- @@@@
- @ @
- @
- @
- @
- @
- @
- @ @
- @@@@
- ",
- d => "
- @@@@
- @ @
- @ @
- @ @
- @ @
- @ @
- @ @
- @ @
- @@@@
- ",
- e => "
- @@@@@
- @
- @
- @
- @@@@
- @
- @
- @
- @@@@@
- ",
- f => "
- @@@@@
- @
- @
- @
- @@@@
- @
- @
- @
- @
- ",
- g => "
- @@@@
- @ @
- @
- @
- @ @@@
- @ @
- @ @
- @ @@
- @@@ @
- ",
- h => "
- @ @
- @ @
- @ @
- @ @
- @@@@@@
- @ @
- @ @
- @ @
- @ @
- ",
- i => "
- @
- @
- @
- @
- @
- @
- @
- @
- @
- ",
- j => "
- @
- @
- @
- @
- @
- @
- @ @
- @ @
- @@
- ",
- k => "
- @ @
- @ @
- @ @
- @@
- @@
- @ @
- @ @
- @ @
- @ @
- ",
- l => "
- @
- @
- @
- @
- @
- @
- @
- @
- @@@@@
- ",
- m => "
- @ @
- @ @
- @@ @@
- @@ @@
- @ @ @ @
- @ @ @ @
- @ @ @
- @ @ @
- @ @
- ",
- n => "
- @ @
- @@ @
- @@ @
- @ @ @
- @ @ @
- @ @ @
- @ @@
- @ @@
- @ @
- ",
- o => "
- @@@@
- @ @
- @ @
- @ @
- @ @
- @ @
- @ @
- @ @
- @@@@
- ",
- p => "
- @@@@@
- @ @
- @ @
- @ @
- @@@@@
- @
- @
- @
- @
- ",
- q => "
- @@@@
- @ @
- @ @
- @ @
- @ @
- @ @
- @ @ @
- @ @@
- @@@@
- @
- ",
- r => "
- @@@@@
- @ @
- @ @
- @ @
- @@@@@
- @ @
- @ @
- @ @
- @ @
- ",
- s => "
- @@@
- @ @
- @
- @
- @@@
- @
- @
- @ @
- @@@
- ",
- t => "
- @@@@@
- @
- @
- @
- @
- @
- @
- @
- @
- ",
- u => "
- @ @
- @ @
- @ @
- @ @
- @ @
- @ @
- @ @
- @ @
- @@@@
- ",
- v => "
- @ @
- @ @
- @ @
- @ @
- @ @
- @ @
- @ @
- @
- @
- ",
- W => "
- @ @
- @ @
- @ @ @
- @ @ @
- @ @ @
- @ @ @ @
- @ @ @ @
- @ @
- @ @
- ",
- x => "
- @ @
- @ @
- @ @
- @ @
- @
- @ @
- @ @
- @ @
- @ @
- ",
- y => "
- @ @
- @ @
- @ @
- @ @
- @
- @
- @
- @
- @
- ",
- z => "
- @@@@@@@
- @
- @
- @
- @
- @
- @
- @
- @@@@@@@
- "
- );
- my $color_fondo = "black";
- my $color_texto = "green";
- my $ven =
- MainWindow->new( -background => $color_fondo, -foreground => $color_texto );
- $ven->title("ASCII Art 0.1 || Written By Doddy H");
- $ven->geometry("555x300+20+20");
- $ven->resizable( 0, 0 );
- my $fondo = $ven->Text(
- -width => 75,
- -heigh => 15,
- -background => $color_fondo,
- -foreground => $color_texto
- )->place( -x => 15, -y => 10 );
- $ven->Label(
- -text => "Text : ",
- -font => "Impact1",
- -background => $color_fondo,
- -foreground => $color_texto
- )->place( -x => 20, -y => 250 );
- my $tengo = $ven->Entry(
- -width => 40,
- -background => $color_fondo,
- -foreground => $color_texto
- )->place( -x => 66, -y => 254 );
- $ven->Button(
- -command => \&now,
- -text => "Now!",
- -width => 10,
- -background => $color_fondo,
- -foreground => $color_texto,
- -activebackground => $color_texto
- )->place( -x => 320, -y => 252 );
- $ven->Button(
- -command => \&about,
- -text => "About",
- -width => 10,
- -background => $color_fondo,
- -foreground => $color_texto,
- -activebackground => $color_texto
- )->place( -x => 395, -y => 252 );
- $ven->Button(
- -command => \&exitnow,
- -text => "Exit",
- -width => 10,
- -background => $color_fondo,
- -foreground => $color_texto,
- -activebackground => $color_texto
- )->place( -x => 470, -y => 252 );
- MainLoop;
- sub about {
- $ven->Dialog(
- -title => "About",
- -buttons => ["OK"],
- -text => "Coded By Doddy H",
- -background => $color_fondo,
- -foreground => $color_texto,
- -activebackground => $color_texto
- )->Show();
- }
- sub exitnow {
- exit(1);
- }
- sub now {
- $fondo->delete( "0.1", "end" );
- my $now = $tengo->get;
- my $code = artnow($now);
- $fondo->insert( "end", $code );
- }
- sub artnow {
- my $target = shift;
- my $fondo = " ";
- my $espacio = 0;
- my $lugar;
- my @lotengo;
- my $tipox = $letras{"a"};
- my @lineas = split /\n/, $tipox;
- $altura = @lineas + 1;
- $anchura = max map { length $_ } @lineas;
- for ( 1 .. $altura ) {
- push @lotengo, $fondo x ( ( $anchura + $espacio ) * length $target );
- }
- for my $letra ( split //, $target ) {
- my @lineas = split /\n/, $letras{$letra};
- for my $i ( 0 .. $altura - 1 ) {
- ( my $plan = $lineas[$i] ) =~ s/ /$fondo/g;
- $plan = $fondo x $anchura if not $plan;
- substr( $lotengo[$i], $lugar, length $plan ) = $plan;
- }
- $lugar += $anchura + $espacio;
- }
- return ( join "\n", @lotengo );
- }
- #The End ?
Coloreado en 0.006 segundos, usando GeSHi 1.0.8.4
Una imagen
[center][/center]