PERLTETRIS(1)
β¨ NAME β¨
PERLTETRIS(1) bestie!! This page comes from the User Contributed Perl Documentation, and it's all about tetris β A tetris game. No cap, that's the name. π
π SYNOPSIS π
perl tetris.pl
Run it like that, fr fr. β¨
π¦ CONFIGURATION π¦
Okay so the configuration file? It should be the file with name .tetris under your HOME directory. That's the main character. Another option is using Tetris/Config.pm in any directory of @INC. Both lowkey iconic.
Here's an example of configuration, and yes it's giving Perl:
# -*- perl -*-
%Config = (
%Config,
'start_level' => 3,
'down_step' => 2,
'keybindings' => {
%{$Config{keybindings}},
ord('j') => \&move_left,
ord('l') => \&move_right,
ord('k') => \&rotate,
ord('n') => \&new_game,
}
);
push @$shapes, shape_from_string(<<SHAPE);
0 0 8 0 0 8 0 0 0 8 8 8 0 0 0 8
0 0 8 0 0 8 8 8 0 0 8 0 0 8 8 8
0 8 8 8 0 8 0 0 0 0 8 0 0 0 0 8
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SHAPE
push @$shapes, shape_from_string(<<SHAPE);
0 0 9 0 0 0 0 0 0 0 0 0 0 0 9 0
0 0 9 9 0 0 9 9 0 9 9 0 0 9 9 0
0 0 0 0 0 0 9 0 0 0 9 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SHAPE
The key specification can get from this script, bestie:
use Gtk2::Gdk::Keysyms;
use Glib qw/TRUE FALSE/;
use Gtk2 -init;
my $window = Gtk2::Window->new ('toplevel');
$window->signal_connect (delete_event => sub { Gtk2->main_quit });
$window->signal_connect('key-press-event' => \&show_key);
my $label = Gtk2::Label->new();
$label->set_markup("<span foreground=\"blue\" size=\"x-large\">Type something on the keyboard!</span>");
$window->add ($label);
$window->show_all;
$window->set_position ('center-always');
Gtk2->main;
sub show_key {
my ($widget,$event,$parameter)= @_;
my $key_nr = $event->keyval();
foreach my $key (keys %Gtk2::Gdk::Keysyms) {
my $key_compare = $Gtk2::Gdk::Keysyms{$key};
if ($key_compare == $key_nr) {
print "'$key' => $key_nr,\n";
}
}
return FALSE;
}
Code to run after the GUI setup, add to code ref $after_load_function. That's the whole vibe. π
perl v5.42.0 π«Ά 2025-07-25 π«Ά PERLTETRIS(1) β bye bestie, go play Tetris π
π¦ where this page comes from
- fedora 43: perl-Goo-Canvas 0.06-60.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms