This file is indexed.

/usr/lib/perl5/pods/SDLx/Layer.pod is in libsdl-perl 2.540-5.

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
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
=head1 NAME

SDLx::Layer - Storage object for surface and position information

=head1 CATEGORY 

Extension

=head1 SYNOPSIS

  use SDLx::Layer;
  use SDLx::LayerManager;
  
  use SDL::Image;
  use SDL::Surface;
  use SDL::Video;
  
  # creating layers
  my $layer1 = SDLx::Layer->new( SDL::Image::load('image1.png'), {userdata => '7'} );
  my $layer2 = SDLx::Layer->new( SDL::Image::load('image2.png'), 100, 200, {userdata => '42'} );
  
  # creating the manager that holds the layers
  my $layermanager = SDLx::LayerManager->new();
  $layermanager->add( $layer1 );
  $layermanager->add( $layer2 );
  
  my $display = # create your video surface here
  
  $layer1->foreground;
  printf( "%s\n", $layer1->behind->[0]->data->{userdata} ); # prints 42

=head1 DESCRIPTION

A layer (see SDLx::Layer) is an SDL::Surface, the position of the surface on screen and some additional information, e.g. ingame states.

=head1 METHODS

=head2 new

  my $layer = SDLx::Layer->new( $surface );
  my $layer = SDLx::Layer->new( $surface,                                   %data );
  my $layer = SDLx::Layer->new( $surface, $pos_x,                           %data );
  my $layer = SDLx::Layer->new( $surface, $pos_x, $pos_y,                   %data );
  my $layer = SDLx::Layer->new( $surface, $pos_x, $pos_y, $clip_w,          %data );
  my $layer = SDLx::Layer->new( $surface, $pos_x, $pos_y, $clip_w, $clip_h, %data );

This constructs the layer object. See how you can omit the position and dimension of the layer. The hash C<%data> is for your use only.
The layer object just pass it through.

=head2 index

  my $index = $layer->index;

The method C<index> represents the z-index of this layer within its layermanager.

=head2 x

  my $x = $layer->x;

This is a shortcut for $layer->pos->x.

=head2 y

  my $y = $layer->y;

This is a shortcut for $layer->pos->y.

=head2 w

  my $w = $layer->w;

This is a shortcut for $layer->clip->w.

=head2 h

  my $h = $layer->h;

This is a shortcut for $layer->pos->h.

=head2 surface

  my $surface = $layer->surface;
  my $surface = $layer->surface( $new_surface );

B<Example>:

  SDL::Video::blit_surface( $layer->surface, $layer->clip, $destination_surface, $layer->pos );

This method let you retrieve the current or set a new surface.

=head2 pos

  my $rect = $layer->pos;

The method C<pos> returns an SDL::Rect object. The pos x and y are stored there.

B<Example>:

  SDL::Video::blit_surface( $layer->surface, $layer->clip, $destination_surface, $layer->pos );

=head2 clip

  my $rect = $layer->clip;

The method C<clip> returns an SDL::Rect object. The clip width and height are stored there.

B<Example>:

  SDL::Video::blit_surface( $layer->surface, $layer->clip, $destination_surface, $layer->pos );

=head2 data

  my %data = %{ $layer->data };
  my %data = %{ $layer->data( %new_data) };

This method returns the hash C<%data>. You can set C<%data> by passing a hash.

=head2 ahead

  my @layers = $layer->ahead;

This method returns all layers that are ahead of the given layer.
Ahead means that a layer has a higher z-index and is blitted over the given layer.

B<Note>: This method doesn't check for transparency. This will change in future versions.

=head2 behind

  my @layers = $layer->behind;

This method returns all layers that are behind of the given layer.
Behind means that a layer has a lower z-index and is blitted over the given layer.

B<Note>: This method doesn't check for transparency. This will change in future versions.

=head2 attach

  $layer->attach( $x, $y );

This function makes the given layer sticky to the mouse. If you move the mouse the layer will follow.
The layermanager blits this layer at last, so they will appear on top of all layers.

C<$x> and C<$y> should be set to the coords of the mouse, e.g. the coords of the mouse click.
If you omit C<$x> and C<$y> the layer obtains them via SDL::Events::get_mouse_state.

B<Note>: The z-index is not changed for the given layer.

=head2 detach_xy

  $layer->detach_xy( $x, $y );

C<detach_xy> detaches the previously attached layer to the given coords. The upper left corner of this layer will be at C<$x> and C<$y>.

=head2 foreground

  $layer->foreground;

This method moves the given layer to the foreground so that it is blitted on top of the other layers.

=head1 BUGS

Report at sdlperl.ath.cx

=head1 SUPPORT

#sdl irc.perl.org

=head1 AUTHORS

See L<SDL/AUTHORS>.

=head1 COPYRIGHT

This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the
LICENSE file included with this module.


=head1 SEE ALSO

perl(1), SDL(2).

=cut