]> mj.ucw.cz Git - anim.git/commitdiff
Clean up old cruft.
authorMartin Mares <mj@ucw.cz>
Sun, 28 Oct 2007 22:31:28 +0000 (23:31 +0100)
committerMartin Mares <mj@ucw.cz>
Sun, 28 Oct 2007 22:31:28 +0000 (23:31 +0100)
AA/UI.pm
a.pl [deleted file]
gdktest.pl [deleted file]
goldberg.pl [new file with mode: 0755]
test.pl [deleted file]
test0.pl [deleted file]
test1.pl [deleted file]

index 0b7af2ecef811eab49debb443ceb615367470ceb..1d4bb8acc678d26738669794ac7508a6fe329167 100644 (file)
--- a/AA/UI.pm
+++ b/AA/UI.pm
@@ -158,8 +158,8 @@ sub prepare() {
        $window->show_all;
 }
 
-sub RunScenario($$$) {
-       my ($ui, $scenario, $live) = @_;
+sub RunScenario($$) {
+       my ($ui, $scenario) = @_;
 
        if ($ui->{MODE}) {
                print "Rendering...\n";
diff --git a/a.pl b/a.pl
deleted file mode 100755 (executable)
index ca03003..0000000
--- a/a.pl
+++ /dev/null
@@ -1,171 +0,0 @@
-#!/usr/bin/perl -W
-
-use strict;
-use warnings;
-
-use Gtk2 -init;
-use Cairo;
-
-use AA;
-use AA::Gfx;
-use AA::UI;
-use AA::Graph;
-use AA::Net;
-use AA::Anim;
-
-my $ui = AA::UI->new('');
-
-my $back = AA::Background->new('bg');
-
-my $title = AA::Label->new('title');
-$title->MultiSet(
-       'text' => 'Goldbergův algoritmus',
-       'size' => 60,
-       'x' => 1024/2,
-       'y' => 80,
-);
-
-my @v;
-for (my $i=0; $i<5; $i++) {
-       my $v = AA::NetV->new("v$i");
-       $v->MultiSet(
-               'x' => 100 + 180*$i,
-               'y0' => 600,
-               'label' => ($i == 0) ? "Z" : ($i == 4) ? "S" : $i,
-               'h' => ($i == 0) ? 5 : 0,
-       );
-       push @v, $v;
-}
-
-my @e;
-for (my $i=0; $i<4; $i++) {
-       my $e = AA::NetE->new("e$i", $v[$i], $v[$i+1]);
-       $e->Set('c', 5);
-       $e->Set('f', 0);
-       push @e, $e;
-}
-
-for (my $i=1; $i<@v; $i++) {
-       my $ii = $i;    # need to keep a copy in the current closure
-       $v[$i]->Bind('xs', sub { $e[$ii-1]->Get('f') - (($ii == @v-1) ? 0 : $e[$ii]->Get('f')) });
-}
-$v[4]->{XS}->Set('color', [0,1,0]);
-
-sub flow($$) {
-       my ($i,$df) = @_;
-       $e[$i]->Set('f', $e[$i]->Get('f') + $df);
-}
-
-sub up($) {
-       my ($i) = @_;
-       $v[$i]->Set('h', $v[$i]->Get('h') + 1);
-}
-
-sub hint($) {
-       my ($h) = @_;
-       for (my $i=0; $i<@v; $i++) {
-               $v[$i]->Set('hint', $i == $h);
-       }
-}
-
-my $scenario;
-
-if (!@ARGV || $ARGV[0] eq "1") {
-       $scenario = [
-               sub { flow(0, 5);       hint(1); },
-               sub { up(1); },
-               sub { flow(1, 5);       hint(2); },
-               sub { up(2); },
-               sub { flow(2, 5);       hint(3); },
-               sub { up(3); },
-               sub { flow(3, 5);       hint(-1); },
-       ];
-} elsif ($ARGV[0] eq "2") {
-       $title->Set('text', "Goldberg v úzkých");
-       for (my $i=0; $i<@v-1; $i++) {
-               $e[$i]->Set('c', 5-$i);
-       }
-       $scenario = [
-               sub { flow(0, 5); hint(1); },
-               sub { up(1); },
-               sub { flow(1, 4); hint(2); },
-               sub { up(2); },
-               sub { flow(2, 3); hint(3); },
-               sub { up(3); },
-               sub { flow(3, 2); },
-               sub { up(3); },
-               sub { flow(2, -1); hint(2); },
-               sub { up(2); },
-               sub { flow(1, -1); hint(1); },
-               sub { up(1); },
-               sub { up(1); },
-               sub { flow(1, 1); },
-               sub { up(1); },
-               sub { up(1); },
-               sub { up(1); },
-               sub { flow(0, -1); hint(2); },
-               sub { up(2); },
-               sub { flow(2, 1); hint(3); },
-               sub { up(3); },
-               sub { up(3); },
-               sub { flow(2, -1); hint(2); },
-               sub { up(2); },
-               sub { up(2); },
-               sub { flow(2, 1); hint(3); },
-               sub { up(3); },
-               sub { up(3); },
-               sub { flow(2, -1); hint(2); },
-               sub { up(2); },
-               sub { up(2); },
-               sub { flow(2, 1); },
-               sub { flow(1, -1); hint(1); },
-               sub { flow(0, -1); hint(3); },
-               sub { up(3); },
-               sub { up(3); },
-               sub { flow(2, -1); hint(2); },
-               sub { flow(1, -1); hint(1); },
-               sub { flow(0, -1); hint(-1); },
-       ];
-} elsif ($ARGV[0] eq "3") {
-       $title->Set('text', "Goldberg s nejvyšším vrcholem");
-       for (my $i=0; $i<@v-1; $i++) {
-               $e[$i]->Set('c', 5-$i);
-       }
-       $scenario = [
-               sub { flow(0, 5); hint(1); },
-               sub { up(1); },
-               sub { flow(1, 4); },
-               sub { up(1); },
-               sub { up(1); },
-               sub { up(1); },
-               sub { up(1); },
-               sub { up(1); },
-               sub { flow(0, -1); hint(2); },
-               sub { up(2); },
-               sub { flow(2, 3); },
-               sub { up(2); },
-               sub { up(2); },
-               sub { up(2); },
-               sub { up(2); },
-               sub { up(2); },
-               sub { up(2); },
-               sub { flow(1, -1); hint(1); },
-               sub { flow(0, -1); hint(3); },
-               sub { up(3); },
-               sub { flow(3, 2); },
-               sub { up(3); },
-               sub { up(3); },
-               sub { up(3); },
-               sub { up(3); },
-               sub { up(3); },
-               sub { up(3); },
-               sub { up(3); },
-               sub { flow(2, -1); hint(2); },
-               sub { flow(1, -1); hint(1); },
-               sub { flow(0, -1); hint(-1); },
-       ];
-} else {
-       die "What do you want?\n";
-}
-
-$ui->RunScenario($scenario, 1);
diff --git a/gdktest.pl b/gdktest.pl
deleted file mode 100755 (executable)
index 2ec701b..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Gtk2 -init;
-
-my $area = Gtk2::DrawingArea->new();
-my $xx = 0;
-sub draw() {
-       my $win = $area->window;
-       my $alloc = $area->allocation;
-       my $w = $alloc->width;
-       my $h = $alloc->height;
-       print "Area $w x $h\n";
-
-       ## my $sty = $area->style;
-       ## my $gc = $sty->fg_gc($area->state);
-       my $gc = Gtk2::Gdk::GC->new($win);
-       $gc->set_rgb_background(0x000000);
-       $gc->set_rgb_foreground(0x000000);
-       $win->draw_rectangle($gc, 1, 0, 0, $w, $h);
-       $gc->set_rgb_foreground(0x00ff00);
-       $win->draw_line($gc, $xx, 0, $w-1, $h-1);
-       $xx++;
-       if ($xx >= $w) { $xx=0; }
-}
-
-my $timer;
-$area->signal_connect("expose-event" => sub {
-       draw();
-       if (!defined $timer) {
-               $timer = Glib::Timeout->add(10, sub { draw(); return 1; });
-       }
-});
-
-my $window = Gtk2::Window->new ('toplevel');
-$window->signal_connect ("delete-event" => sub { Gtk2->main_quit });
-$window->set_title("Brum");
-$window->set_wmclass("anim", "Anim");
-$window->set_default_size(640, 480);
-$window->add ($area);
-$window->show_all;
-#$window->fullscreen;
-
-Gtk2->main;
diff --git a/goldberg.pl b/goldberg.pl
new file mode 100755 (executable)
index 0000000..af30927
--- /dev/null
@@ -0,0 +1,171 @@
+#!/usr/bin/perl -W
+
+use strict;
+use warnings;
+
+use Gtk2 -init;
+use Cairo;
+
+use AA;
+use AA::Gfx;
+use AA::UI;
+use AA::Graph;
+use AA::Net;
+use AA::Anim;
+
+my $ui = AA::UI->new('');
+
+my $back = AA::Background->new('bg');
+
+my $title = AA::Label->new('title');
+$title->MultiSet(
+       'text' => 'Goldbergův algoritmus',
+       'size' => 60,
+       'x' => 1024/2,
+       'y' => 80,
+);
+
+my @v;
+for (my $i=0; $i<5; $i++) {
+       my $v = AA::NetV->new("v$i");
+       $v->MultiSet(
+               'x' => 100 + 180*$i,
+               'y0' => 600,
+               'label' => ($i == 0) ? "Z" : ($i == 4) ? "S" : $i,
+               'h' => ($i == 0) ? 5 : 0,
+       );
+       push @v, $v;
+}
+
+my @e;
+for (my $i=0; $i<4; $i++) {
+       my $e = AA::NetE->new("e$i", $v[$i], $v[$i+1]);
+       $e->Set('c', 5);
+       $e->Set('f', 0);
+       push @e, $e;
+}
+
+for (my $i=1; $i<@v; $i++) {
+       my $ii = $i;    # need to keep a copy in the current closure
+       $v[$i]->Bind('xs', sub { $e[$ii-1]->Get('f') - (($ii == @v-1) ? 0 : $e[$ii]->Get('f')) });
+}
+$v[4]->{XS}->Set('color', [0,1,0]);
+
+sub flow($$) {
+       my ($i,$df) = @_;
+       $e[$i]->Set('f', $e[$i]->Get('f') + $df);
+}
+
+sub up($) {
+       my ($i) = @_;
+       $v[$i]->Set('h', $v[$i]->Get('h') + 1);
+}
+
+sub hint($) {
+       my ($h) = @_;
+       for (my $i=0; $i<@v; $i++) {
+               $v[$i]->Set('hint', $i == $h);
+       }
+}
+
+my $scenario;
+
+if (!@ARGV || $ARGV[0] eq "1") {
+       $scenario = [
+               sub { flow(0, 5);       hint(1); },
+               sub { up(1); },
+               sub { flow(1, 5);       hint(2); },
+               sub { up(2); },
+               sub { flow(2, 5);       hint(3); },
+               sub { up(3); },
+               sub { flow(3, 5);       hint(-1); },
+       ];
+} elsif ($ARGV[0] eq "2") {
+       $title->Set('text', "Goldberg v úzkých");
+       for (my $i=0; $i<@v-1; $i++) {
+               $e[$i]->Set('c', 5-$i);
+       }
+       $scenario = [
+               sub { flow(0, 5); hint(1); },
+               sub { up(1); },
+               sub { flow(1, 4); hint(2); },
+               sub { up(2); },
+               sub { flow(2, 3); hint(3); },
+               sub { up(3); },
+               sub { flow(3, 2); },
+               sub { up(3); },
+               sub { flow(2, -1); hint(2); },
+               sub { up(2); },
+               sub { flow(1, -1); hint(1); },
+               sub { up(1); },
+               sub { up(1); },
+               sub { flow(1, 1); },
+               sub { up(1); },
+               sub { up(1); },
+               sub { up(1); },
+               sub { flow(0, -1); hint(2); },
+               sub { up(2); },
+               sub { flow(2, 1); hint(3); },
+               sub { up(3); },
+               sub { up(3); },
+               sub { flow(2, -1); hint(2); },
+               sub { up(2); },
+               sub { up(2); },
+               sub { flow(2, 1); hint(3); },
+               sub { up(3); },
+               sub { up(3); },
+               sub { flow(2, -1); hint(2); },
+               sub { up(2); },
+               sub { up(2); },
+               sub { flow(2, 1); },
+               sub { flow(1, -1); hint(1); },
+               sub { flow(0, -1); hint(3); },
+               sub { up(3); },
+               sub { up(3); },
+               sub { flow(2, -1); hint(2); },
+               sub { flow(1, -1); hint(1); },
+               sub { flow(0, -1); hint(-1); },
+       ];
+} elsif ($ARGV[0] eq "3") {
+       $title->Set('text', "Goldberg s nejvyšším vrcholem");
+       for (my $i=0; $i<@v-1; $i++) {
+               $e[$i]->Set('c', 5-$i);
+       }
+       $scenario = [
+               sub { flow(0, 5); hint(1); },
+               sub { up(1); },
+               sub { flow(1, 4); },
+               sub { up(1); },
+               sub { up(1); },
+               sub { up(1); },
+               sub { up(1); },
+               sub { up(1); },
+               sub { flow(0, -1); hint(2); },
+               sub { up(2); },
+               sub { flow(2, 3); },
+               sub { up(2); },
+               sub { up(2); },
+               sub { up(2); },
+               sub { up(2); },
+               sub { up(2); },
+               sub { up(2); },
+               sub { flow(1, -1); hint(1); },
+               sub { flow(0, -1); hint(3); },
+               sub { up(3); },
+               sub { flow(3, 2); },
+               sub { up(3); },
+               sub { up(3); },
+               sub { up(3); },
+               sub { up(3); },
+               sub { up(3); },
+               sub { up(3); },
+               sub { up(3); },
+               sub { flow(2, -1); hint(2); },
+               sub { flow(1, -1); hint(1); },
+               sub { flow(0, -1); hint(-1); },
+       ];
+} else {
+       die "What do you want?\n";
+}
+
+$ui->RunScenario($scenario);
diff --git a/test.pl b/test.pl
deleted file mode 100755 (executable)
index 2390174..0000000
--- a/test.pl
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Gtk2 -init;
-use Cairo;
-
-my $area = Gtk2::DrawingArea->new();
-my $cairo;
-my $PI = 3.1415926535;
-my $TWOPI = 2*$PI;
-
-my $rad = 30;
-my $rim = 2;
-my $arrow_dist = 10;
-my $arrow_span = 5;
-
-sub draw_vertex($$) {
-       my ($x, $y) = @_;
-
-       my $lg = Cairo::RadialGradient->create($x, $y, 0, $x, $y, $rad);
-       $lg->add_color_stop_rgb(0, 0.7, 0, 0.7);
-       $lg->add_color_stop_rgb(1, 0.3, 0, 0.3);
-
-       $cairo->arc($x, $y, $rad, 0, $TWOPI);
-       $cairo->set_source($lg);
-       $cairo->fill;
-
-       $cairo->arc($x, $y, $rad, 0, $TWOPI);
-       $cairo->set_source_rgb(1, 1, 1);
-       $cairo->set_line_width($rim);
-       $cairo->stroke;
-
-       $cairo->set_font_size(0.6*$rad);
-       my $xt = $cairo->text_extents('Brum');
-       $cairo->move_to($x - $xt->{'width'}/2 - $xt->{'x_bearing'},
-                       $y - $xt->{'height'}/2 - $xt->{'y_bearing'});
-       $cairo->show_text("Brum");
-}
-
-sub draw_edge($$$$) {
-       my ($x1, $y1, $x2, $y2) = @_;
-       my $dx = $x2 - $x1;
-       my $dy = $y2 - $y1;
-       my $d = sqrt($dx*$dx + $dy*$dy);
-
-       $x1 += $dx * $rad/$d;
-       $y1 += $dy * $rad/$d;
-       $x2 -= $dx * $rad/$d;
-       $y2 -= $dy * $rad/$d;
-
-       $cairo->set_source_rgb(1, 1, 1);
-
-       $cairo->move_to($x1, $y1);
-       $cairo->line_to($x2, $y2);
-       $cairo->set_line_width(2);
-       $cairo->stroke;
-
-       my $ax = $x2 - $dx * $arrow_dist/$d;
-       my $ay = $y2 - $dy * $arrow_dist/$d;
-       my $adx = -$dy;
-       my $ady = $dx;
-       ($adx, $ady) = ($adx * $arrow_span/$d, $ady * $arrow_span/$d);
-       $cairo->move_to($x2, $y2);
-       $cairo->line_to($ax+$adx, $ay+$ady);
-       $cairo->line_to($ax-$adx, $ay-$ady);
-       $cairo->close_path;
-       $cairo->fill;
-}
-
-my $xx=0;
-my $pixmap;
-my ($lastw, $lasth, $lastd) = (-1, -1, -1);
-my ($pixw, $pixh) = (-1, -1);
-sub draw($) {
-       my ($force) = @_;
-       my $win = $area->window;
-       my $wgc = Gtk2::Gdk::GC->new($win);
-       my $alloc = $area->allocation;
-       my $w = $alloc->width;
-       my $h = $alloc->height;
-       my $d = $win->get_depth;
-       # print "Area $w x $h x $d, xx=$xx\n";
-
-       if (!defined($pixmap) || $lastw != $w || $lasth != $h || $lastd != $d) {
-               ($lastw, $lasth, $lastd) = ($w, $h, $d);
-               if ($w/$h >= 4/3) {
-                       $pixh = $h;
-                       $pixw = int($h/3*4);
-               } else {
-                       $pixw = $w;
-                       $pixh = int($w/4*3);
-               }
-               print "Resized to ${w}x${h}, pixmap size ${pixw}x${pixh}\n";
-
-               $pixmap = Gtk2::Gdk::Pixmap->new($win, $pixw, $pixh, $d);
-               $cairo = Gtk2::Gdk::Cairo::Context->create($pixmap);
-               $cairo->select_font_face('URW Palladio L', 'normal', 'normal');
-               my $scale = $pixw/1024;
-               $cairo->scale($scale, $scale);
-       }
-
-       if ($force) {
-               $wgc->set_rgb_background(0);
-               $wgc->set_rgb_foreground(0);
-               $win->draw_rectangle($wgc, 1, 0, 0, $w, $h);
-       }
-
-       $cairo->rectangle(0, 0, 1024, 768);
-       $cairo->set_source_rgb(0, 0, 0);
-       $cairo->fill;
-
-       my @v = ();
-       for (my $i=0; $i<6; $i++) {
-               my $a = $TWOPI/6 * $i + $TWOPI/400*$xx;
-               my $x = int(1024/2 + 300*cos($a));
-               my $y = int(768/2 + 300*sin($a));
-               draw_vertex($x, $y);
-               push @v, { 'x' => $x, 'y' => $y };
-       }
-
-       for (my $i=1; $i<6; $i++) {
-               for (my $j=0; $j<$i; $j++) {
-                       my $v = $v[$i];
-                       my $w = $v[$j];
-                       draw_edge($v->{'x'}, $v->{'y'}, $w->{'x'}, $w->{'y'});
-               }
-       }
-
-       $win->draw_drawable($wgc, $pixmap, 0, 0, 0, 0, $pixw, $pixh);
-}
-
-sub step() {
-       draw(0);
-       $xx++;
-}
-
-my $timer;
-my $stopped = 0;
-$area->signal_connect("expose-event" => sub {
-       draw(1);
-       if (!defined $timer) {
-               $timer = Glib::Timeout->add(30, sub { $stopped || step(); return 1; });
-       }
-});
-$area->set_flags('can-focus');
-# $area->add_events('key-press-mask');
-$area->signal_connect('key-press-event' => sub {
-       my ($w, $evt) = @_;
-       my $k = Gtk2::Gdk::keyval_name(0, $evt->keyval);
-       print "Pressed key $k\n";
-       if ($k eq "Escape") {
-               Gtk2->main_quit;
-       } elsif ($k eq "space") {
-               $stopped = !$stopped;
-       }
-});
-
-my $window = Gtk2::Window->new ('toplevel');
-$window->signal_connect ("delete-event" => sub { Gtk2->main_quit });
-$window->set_title("Brum");
-$window->set_wmclass("anim", "Anim");
-$window->set_default_size(640, 480);
-$window->add ($area);
-$window->show_all;
-#$window->fullscreen;
-
-Gtk2->main;
diff --git a/test0.pl b/test0.pl
deleted file mode 100755 (executable)
index 3b634d5..0000000
--- a/test0.pl
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Gtk2 -init;
-use Cairo;
-
-my $area = Gtk2::DrawingArea->new();
-my $cairo;
-my $xx=0;
-my $pixmap;
-my ($pixw, $pixh, $pixd) = (-1, -1, -1);
-sub draw() {
-       my $win = $area->window;
-       my $alloc = $area->allocation;
-       my $w = $alloc->width;
-       my $h = $alloc->height;
-       my $d = $win->get_depth;
-       # print "Area $w x $h x $d, xx=$xx\n";
-
-       if (!defined($pixmap) || $pixw != $w || $pixh != $h || $pixd != $d) {
-               $pixmap = Gtk2::Gdk::Pixmap->new($win, $w, $h, $d);
-               ($pixw, $pixh, $pixd) = ($w, $h, $d);
-               $cairo = Gtk2::Gdk::Cairo::Context->create($pixmap);
-       }
-
-       $cairo->rectangle(0, 0, $w, $h);
-       $cairo->set_source_rgb(0, 0, 0);
-       $cairo->fill;
-
-       $cairo->rectangle($xx, 10, 40, 40);
-       $cairo->set_source_rgb(0, 0, 1);
-       $cairo->fill;
-
-       #my $gc = Gtk2::Gdk::GC->new($pixmap);
-       #$gc->set_rgb_background(0x000000);
-       #$gc->set_rgb_foreground(0x00ff00);
-       #$pixmap->draw_line($gc, $xx, 0, $w-1, $h-1);
-
-       my $wgc = Gtk2::Gdk::GC->new($win);
-       $win->draw_drawable($wgc, $pixmap, 0, 0, 0, 0, $w, $h);
-
-       $xx+=1;
-}
-
-my $timer;
-$area->signal_connect("expose-event" => sub {
-       draw();
-       if (!defined $timer) {
-               $timer = Glib::Timeout->add(10, sub { draw(); return 1; });
-       }
-});
-$area->set_flags('can-focus');
-# $area->add_events('key-press-mask');
-$area->signal_connect('key-press-event' => sub {
-       my ($w, $evt) = @_;
-       my $k = Gtk2::Gdk::keyval_name(0, $evt->keyval);
-       print "Pressed key $k\n";
-       if ($k eq "Escape") {
-               Gtk2->main_quit;
-       }
-});
-
-my $window = Gtk2::Window->new ('toplevel');
-$window->signal_connect ("delete-event" => sub { Gtk2->main_quit });
-$window->set_title("Brum");
-$window->set_wmclass("anim", "Anim");
-$window->set_default_size(640, 480);
-$window->add ($area);
-$window->show_all;
-$window->fullscreen;
-
-Gtk2->main;
diff --git a/test1.pl b/test1.pl
deleted file mode 100755 (executable)
index 5502883..0000000
--- a/test1.pl
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Gtk2 -init;
-use Cairo;
-
-my $area = Gtk2::DrawingArea->new();
-my $cairo;
-
-sub draw_vertex($$) {
-       my ($x, $y) = @_;
-       my $rad = 100;
-       my $rim = 3;
-
-       my $lg = Cairo::RadialGradient->create($x, $y, 0, $x, $y, $rad);
-       $lg->add_color_stop_rgb(0, 0.7, 0, 0.7);
-       $lg->add_color_stop_rgb(1, 0.3, 0, 0.3);
-
-       $cairo->arc($x, $y, $rad, 0, 2*3.141592);
-       $cairo->set_source($lg);
-       $cairo->fill;
-
-       $cairo->arc($x, $y, $rad, 0, 2*3.141592);
-       $cairo->set_source_rgb(1, 1, 1);
-       $cairo->set_line_width($rim);
-       $cairo->stroke;
-
-       $cairo->set_font_size(0.6*$rad);
-       my $xt = $cairo->text_extents('Brum');
-       $cairo->move_to($x - $xt->{'width'}/2 - $xt->{'x_bearing'},
-                       $y - $xt->{'height'}/2 - $xt->{'y_bearing'});
-       $cairo->show_text("Brum");
-}
-
-my $xx=0;
-my $pixmap;
-my ($lastw, $lasth, $lastd) = (-1, -1, -1);
-my ($pixw, $pixh) = (-1, -1);
-sub draw($) {
-       my ($force) = @_;
-       my $win = $area->window;
-       my $wgc = Gtk2::Gdk::GC->new($win);
-       my $alloc = $area->allocation;
-       my $w = $alloc->width;
-       my $h = $alloc->height;
-       my $d = $win->get_depth;
-       # print "Area $w x $h x $d, xx=$xx\n";
-
-       if (!defined($pixmap) || $lastw != $w || $lasth != $h || $lastd != $d) {
-               ($lastw, $lasth, $lastd) = ($w, $h, $d);
-               if ($w/$h >= 4/3) {
-                       $pixh = $h;
-                       $pixw = int($h/3*4);
-               } else {
-                       $pixw = $w;
-                       $pixh = int($w/4*3);
-               }
-               print "Resized to ${w}x${h}, pixmap size ${pixw}x${pixh}\n";
-
-               if ($force) {
-                       $wgc->set_rgb_background(0);
-                       $wgc->set_rgb_foreground(0);
-                       $win->draw_rectangle($wgc, 1, 0, 0, $w, $h);
-               }
-
-               $pixmap = Gtk2::Gdk::Pixmap->new($win, $pixw, $pixh, $d);
-               $cairo = Gtk2::Gdk::Cairo::Context->create($pixmap);
-               $cairo->select_font_face('URW Palladio L', 'normal', 'normal');
-               my $scale = $pixw/1024;
-               $cairo->scale($scale, $scale);
-       }
-
-       $cairo->rectangle(0, 0, 1024, 768);
-       $cairo->set_source_rgb(0, 0, 0);
-       $cairo->fill;
-
-       draw_vertex(4/3*$xx, $xx);
-
-       $win->draw_drawable($wgc, $pixmap, 0, 0, 0, 0, $pixw, $pixh);
-}
-
-sub step() {
-       draw(0);
-       $xx++;
-}
-
-my $timer;
-my $stopped = 0;
-$area->signal_connect("expose-event" => sub {
-       draw(1);
-       if (!defined $timer) {
-               $timer = Glib::Timeout->add(100, sub { $stopped || step(); return 1; });
-       }
-});
-$area->set_flags('can-focus');
-# $area->add_events('key-press-mask');
-$area->signal_connect('key-press-event' => sub {
-       my ($w, $evt) = @_;
-       my $k = Gtk2::Gdk::keyval_name(0, $evt->keyval);
-       print "Pressed key $k\n";
-       if ($k eq "Escape") {
-               Gtk2->main_quit;
-       } elsif ($k eq "space") {
-               $stopped = !$stopped;
-       }
-});
-
-my $window = Gtk2::Window->new ('toplevel');
-$window->signal_connect ("delete-event" => sub { Gtk2->main_quit });
-$window->set_title("Brum");
-$window->set_wmclass("anim", "Anim");
-$window->set_default_size(640, 480);
-$window->add ($area);
-$window->show_all;
-#$window->fullscreen;
-
-Gtk2->main;