5 # Copyright (C) 2005 David J. Goehrig <dgoehrig@cpan.org>
7 # ------------------------------------------------------------------------------
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with this library; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 # ------------------------------------------------------------------------------
25 # Please feel free to send questions, suggestions or improvements to:
40 my $class = ref($proto) || $proto;
43 verify (%options, qw/ -x -y -width -height -w -h / ) if $SDL::DEBUG;
45 my $x = $options{-x} || 0;
46 my $y = $options{-y} || 0;
47 my $w = $options{-width} || $options{-w} || 0;
48 my $h = $options{-height} || $options{-h} || 0;
49 die SDL::GetError() unless $$self;
51 my $self = \SDL::NewRect($x,$y,$w,$h);
57 SDL::FreeRect(${$_[0]});
62 SDL::RectX($$self,@_);
67 SDL::RectY($$self,@_);
72 SDL::RectW($$self,@_);
77 SDL::RectH($$self,@_);
89 SDL::Rect - a SDL perl extension
93 $rect = new SDL::Rect ( -height => 4, -width => 40 );
97 C<SDL::Rect::new> creates a SDL_Rect structure which is
98 used for specifying regions for filling, blitting, and updating.
99 These objects make it easy to cut and backfill.
100 By default, x, y, h, w are 0.
104 The four fields of a rectangle can be set simply
105 by passing a value to the applicable method. These are:
111 C<SDL::Rect::x> sets and fetches the x position.
115 C<SDL::Rect::y> sets and fetches the y position.
119 C<SDL::Rect::width> sets and fetched the width.
123 C<SDL::Rect::height> sets and fetched the height.
133 perl(1) SDL::Surface(3)