NAME ^

SDL::Button - A multi state SDL Button

SYNOPSIS ^

    # the image to use for the button
    $P0 = new .String
    $P0 = "filename/to/image.png"

    # create the button
    $I0 = find_type 'SDL::Button'
    button = new $I0, $P0

    # set the position
    button.'xpos'( 10 )
    button.'ypos'( 10 )

    # set the number of states    
    button.'states'( 2 )

    # activate the second status (first is 0)
    button = 1

    # draw the button
    button."draw"( screen )

DESCRIPTION ^

A button uses an image containing several images representing different states of a button. You can change the button status at any time, the button will then be drawn differently. Please have a look at examples/sdl/minesweeper/smiley.png for an example.

METHODS ^

An SDL::Button object has the following methods:

button = new ID, name

set_integer_native

get_integer

states( count )

pos( x, y )

size( width, height )

draw( screen )

click( x, y )

raise( arg )

setAction( status, callback )

AUTHOR ^

Jens Rieks <parrot at jensbeimsurfen dot de> is the author and maintainer. Please send patches and suggestions to the Perl 6 Internals mailing list.

COPYRIGHT ^

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


parrot