|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
  
 
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package SDLx::Controller::Interface;  | 
| 
2
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
47
 | 
 use strict;  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
18
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
192
 | 
    | 
| 
3
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
35
 | 
 use warnings;  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
15
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
226
 | 
    | 
| 
4
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
37
 | 
 use Carp qw/confess/;  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
16
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
304
 | 
    | 
| 
5
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
43
 | 
 use Scalar::Util 'refaddr';  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
372
 | 
    | 
| 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our @ISA = qw(Exporter DynaLoader);  | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
9
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
51
 | 
 use SDL::Internal::Loader;  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
26
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3103
 | 
    | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $VERSION = 2.548;  | 
| 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 my %_controller;  | 
| 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub new {  | 
| 
16
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
  
0
  
 | 
8208
 | 
 	shift;  | 
| 
17
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
 	my %foo = @_;  | 
| 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
19
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
 	my @args;  | 
| 
20
 | 
3
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
12
 | 
 	push @args, ( $foo{x}     || 0 );  | 
| 
21
 | 
3
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
9
 | 
 	push @args, ( $foo{y}     || 0 );  | 
| 
22
 | 
3
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
7
 | 
 	push @args, ( $foo{v_x}   || 0 );  | 
| 
23
 | 
3
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
15
 | 
 	push @args, ( $foo{v_y}   || 0 );  | 
| 
24
 | 
3
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
8
 | 
 	push @args, ( $foo{rot}   || 0 );  | 
| 
25
 | 
3
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
9
 | 
 	push @args, ( $foo{ang_v} || 0 );  | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
27
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
33
 | 
 	return SDLx::Controller::Interface->make(@args);  | 
| 
28
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
31
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub attach {  | 
| 
32
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
  
0
  
 | 
14
 | 
 	my ( $self, $controller, $render, @params ) = @_;  | 
| 
33
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
34
 | 
1
 | 
  
 50
  
 | 
  
 33
  
 | 
 
 | 
 
 | 
12
 | 
 	Carp::confess "An SDLx::Controller is needed" unless $controller && $controller->isa('SDLx::Controller');  | 
| 
35
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
36
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
         $_controller{ refaddr $self } = [ $controller ];  | 
| 
37
 | 
1
 | 
 
 | 
 
 | 
  
2
  
 | 
 
 | 
4
 | 
 	my $move = sub { $self->update( $_[2], $_[1]->dt )};  | 
| 
 
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
11
 | 
    | 
| 
38
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
 	$_controller{ refaddr $self }->[1] = $controller->add_move_handler($move);  | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
40
 | 
1
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
3
 | 
 	if ($render) {  | 
| 
41
 | 
1
 | 
 
 | 
 
 | 
  
2
  
 | 
 
 | 
4
 | 
 		my $show = sub { my $state = $self->interpolate( $_[0] ); $render->( $state, @params ); };  | 
| 
 
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
11
 | 
    | 
| 
 
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
    | 
| 
42
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
 		$_controller{ refaddr $self }->[2] = $controller->add_show_handler($show);  | 
| 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	} else {  | 
| 
44
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 		Carp::confess "Render callback not provided";  | 
| 
45
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
46
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
47
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
48
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
49
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub detach {  | 
| 
50
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
  
0
  
 | 
1837
 | 
 	my ( $self) = @_;  | 
| 
51
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
         my $controller = $_controller{ refaddr $self };   | 
| 
52
 | 
1
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
5
 | 
 	return unless $controller;  | 
| 
53
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
 	$controller->[0]->remove_move_handler($controller->[1]);  | 
| 
54
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
 	$controller->[0]->remove_show_handler($controller->[2]);  | 
| 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
56
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
57
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 internal_load_dlls(__PACKAGE__);  | 
| 
58
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 bootstrap SDLx::Controller::Interface;  | 
| 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
60
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
61
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  |