parrotcode: A multi state SDL Button | |
Contents | Libraries |
SDL::Button - A multi state SDL Button
# 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 )
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.
An SDL::Button object has the following methods:
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 (C) 2004-2006, The Perl Foundation.
|