/usr/share/perl5/Dizzy/RotatorManager.pm is in dizzy 0.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | package Dizzy::RotatorManager;
use strict;
use warnings;
use OpenGL qw(:all);
use Time::HiRes qw(sleep time);
use Dizzy::Handlers;
my @rotators;
my $current_rotator_id = 0;
sub add {
my %args = @_;
push(@rotators, \%args);
return $#rotators;
}
sub set {
my ($id) = @_;
Dizzy::Handlers::invoke("rotator_switch",
old_rotator => $current_rotator_id,
new_rotator => $id,
);
}
sub current {
return $rotators[$current_rotator_id]->{function};
}
# -----------------------------------------------------------------------------
# some handlers
# transforms a texture walk request (such as one triggered by cursor keys) into
# something that we all understand: a renderable GL texture ID.
sub handler_walking {
my %args = @_;
if (exists($args{direction})) {
# find out about the next texture
my $id = $current_rotator_id + $args{direction};
$id += @rotators;
$id %= @rotators;
set($id);
return Dizzy::Handlers::STOP;
} else {
return Dizzy::Handlers::GO_ON;
}
}
# this event serves to tell texman that the texture has now changed.
# it is essentially like texture_switch, but this one is needed for texblend
# to work.
sub handler_switched {
my %args = @_;
$current_rotator_id = $args{new_rotator};
Dizzy::Handlers::invoke("rotator_changed",
name => $rotators[$current_rotator_id]->{name},
);
Dizzy::Handlers::STOP;
}
sub init {
my %args = @_;
Dizzy::Handlers::register(
rotator_switch => \&handler_walking,
);
Dizzy::Handlers::register_last(
rotator_switched => \&handler_switched,
);
}
1;
|