Matt S Trout > Rakudo-Star-2012.08_001 > SDL::Button

Download:
Rakudo-Star-2012.08_001.tar.gz

Annotate this POD

Source  

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
    button = new ['SDL'; 'Button'], $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-2008, Parrot Foundation.

syntax highlighting: