File: Default.pm

package info (click to toggle)
dizzy 0.3-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 288 kB
  • sloc: perl: 1,864; makefile: 12; xml: 12; sh: 6
file content (41 lines) | stat: -rw-r--r-- 845 bytes parent folder | download | duplicates (6)
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
package Dizzy::Rotators::Default;

use strict;
use warnings;

use OpenGL qw(glRotatef glTranslatef);

my @rotators = (
	{
		name => "Foobar",
		function => sub {
			my ($tick, $plane) = @_;
			if ($plane == 1) {
				glRotatef(sin($tick * 0.75) * 10 + $tick * 5, 0, 0, 1);
				glTranslatef(sin($tick * 0.5), cos($tick * 0.75), 0);
			} elsif ($plane == 2) {
				glRotatef(sin($tick * 0.25) * 50 + $tick * -2.5, 0, 0, 1);
				glTranslatef(sin($tick * 0.5), cos($tick * 0.75), 0);
			}
		},
	},
	{
		name => "Classic",
		function => sub {
			my ($tick, $plane) = @_;
			if ($plane == 1) {
				glRotatef($tick * 5, 0, 0, 1);
				glTranslatef(sin($tick * 0.5), cos($tick * 0.75), 0);
			} else {
				glRotatef($tick * -2.5, 0, 0, 1);
				glTranslatef(sin($tick * 0.5), cos($tick * 0.75), 0);
			}
		},
	},
);

sub rotators {
	return @rotators;
}

1;