1SDL::Rect(3pm) User Contributed Perl Documentation SDL::Rect(3pm)
2
3
4
6 SDL::Rect - Defines a rectangular area
7
8 CATEGORY
9 Core, Video, Structure
10
12 my $rect = SDL::Rect->new(0, 0, 50, 4);
13 $rect->x(1);
14 $rect->y(2);
15 $rect->w(3);
16 my $x = $rect->x; # 1
17 my $y = $rect->y; # 2
18 my $w = $rect->w; # 3
19 my $h = $rect->h; # 4
20
22 An "SDL_Rect" defines a rectangular area of pixels.
23
25 new
26 my $rect = SDL::Rect->new( $x, $y, $w, $h );
27
28 The constructor creates a new rectangle with the specified x, y, width
29 and height values.
30
31 x
32 my $x = $rect->x;
33 $rect->x(128);
34
35 If passed a value, this method sets the x component of the rectangle;
36 if not, it returns the x component of the rectangle.
37
38 y
39 my $y = $rect->y;
40 $rect->y(128);
41
42 If passed a value, this method sets the y component of the rectangle;
43 if not, it returns the y component of the rectangle.
44
45 w
46 my $w = $rect->w;
47 $rect->w(128);
48
49 If passed a value, this method sets the w component of the rectangle;
50 if not, it returns the w component of the rectangle.
51
52 h
53 my $h = $rect->h;
54 $rect->h(128);
55
56 If passed a value, this method sets the h component of the rectangle;
57 if not, it returns the h component of the rectangle.
58
60 SDL::Surface
61
63 See "AUTHORS" in SDL.
64
65
66
67perl v5.38.0 2023-07-21 SDL::Rect(3pm)