NAME
SDL::Rect - Defines a rectangular area
CATEGORY
Core, Video, Structure
SYNOPSIS
my $rect = SDL::Rect->new( 0, 0, 0, 0 );
$rect->x(1);
$rect->y(2);
$rect->w(3);
$rect->h(4);
my $x = $rect->x; # 1
my $y = $rect->y; # 2
my $w = $rect->w; # 3
my $h = $rect->h; # 4
DESCRIPTION
An SDL_Rect
defines a rectangular area of pixels.
METHODS
new ( $x, $y, $w, $h )
The constructor creates a new rectangle with the specified x, y, w, h values:
my $rect = SDL::Rect->new( 0, 0, 0, 0 );
x
If passed a value, this method sets the x component of the rectangle; if not, it returns the x component of the rectangle:
my $x = $rect->x; # 255
$rect->x(128);
y
If passed a value, this method sets the y component of the rectangle; if not, it returns the y component of the rectangle:
my $y = $rect->y; # 255
$rect->y(128);
w
If passed a value, this method sets the w component of the rectangle; if not, it returns the w component of the rectangle:
my $w = $rect->w; # 255
$rect->w(128);
h
If passed a value, this method sets the h component of the rectangle; if not, it returns the h component of the rectangle:
my $h = $rect->h; # 255
$rect->h(128);