GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  PERLTETRIS.PL (1)

.ds Aq ’

NAME

tetris - A tetris game

CONTENTS

SYNOPSIS

perl tetris.pl

CONFIGURATION

The configuration file should be the file with name .tetris under HOME directory. Another option is using Tetris/Config.pm in any directory of @INC.

Here is an example of configuration:
# -*- 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:



    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.

Search for    or go to Top of page |  Section 1 |  Main Index


perl v5.20.3 PERLTETRIS (1) 2007-11-10

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.