NAME ^

SDL::Rect - Parrot class representing rectangles in Parrot SDL

SYNOPSIS ^

        # load this library
        load_bytecode 'library/SDL/Rect.pir'

        # create a new SDL::Rect object
        .local pmc rect
        .local int rect_type

        find_type rect_type, 'SDL::Rect'
        rect = new rect_type

        # now set the arguments on the object
        rect.'init'( 'x' => 270, 'y' => 190, 'height' => 100, 'width'=> 100 )

        # ... and blit to or fill surfaces with this object!

DESCRIPTION ^

The SDL::Rect class represents rects in SDL. SDL::Rect objects represent sources and destinations for filling and blitting to and from SDL::Surface objects.

METHODS ^

An SDL::Rect object has the following methods:

init( arg => value )

Given a list of key-value pairs, sets the attributes of this object. The keys are:

x

The x coordinate of this object, in pixels. This represents a position within a SDL::Surface object, but it's an attribute of the rect, not the surface.

y

The y coordinate of this object, in pixels. This represents a position within a SDL::Surface object, but it's an attribute of the rect, not the surface.

height

The height, in pixels, of this object.

width

The width, in pixels, of this object.

The name of this method may change, as per discussion on p6i.

rect()

This method returns the underlying SDL_Rect. You'll probably never need to call this directly, unless you're using raw SDL functions.

height()

Returns the height of this object in pixels. Arguably, this should also set the value.

width()

Returns the width of this object in pixels. Arguably, this should also set the value.

x( [ new_x_coordinate ] )

Gets and sets the x coordinate of this rect. Note that this value is always an integer.

y( [ new_y_coordinate ] )

Gets and sets the y coordinate of this rect. Note that this value is always an integer.

AUTHOR ^

Written and maintained by chromatic, <chromatic at wgz dot org>, with suggestions from Jens Rieks. Please send patches, feedback, and suggestions to the Perl 6 Internals mailing list.

COPYRIGHT ^

Copyright (C) 2004-2006, The Perl Foundation.


parrot