| Term-Caca documentation | Contained in the Term-Caca distribution. |
Term::Caca::Sprite - an OO-interface to caca_sprite
Basic usage
use Term::Caca::Sprite;
eval {
my $sprite = Term::Caca::Sprite->new('/tmp/sprite.txt');
my ($x, $y, $frame) = (8, 20, 0);
$sprite->draw($x, $y, $frame);
};
# The destructor will take care of releasing memory.
a brief summary of the module written with users in mind.
...
Example:
The load() method is a synonym for new() and they can be used interchangably.
...
Example:
...
Example:
...
Example:
...
Example:
...
Example:
...
Example:
...
Example:
cvars
no errors
John BEPPU <beppu@cpan.org>
perl(1)
| Term-Caca documentation | Contained in the Term-Caca distribution. |
package Term::Caca::Sprite; use strict; use warnings; use Term::Caca; sub new { my ($class, $file) = @_; my $self = Term::Caca::_load_sprite($file); return bless($self => $class); } *load = \*new; sub get_frames { my ($self) = @_; return Term::Caca::_get_sprite_frames($self); } sub get_width { my ($self, $frame) = @_; return Term::Caca::_get_sprite_width($self, $frame); } sub get_height { my ($self, $frame) = @_; return Term::Caca::_get_sprite_height($self, $frame); } sub get_dx { my ($self, $frame) = @_; return Term::Caca::_get_sprite_dx($self, $frame); } sub get_dy { my ($self, $frame) = @_; return Term::Caca::_get_sprite_dy($self, $frame); } sub draw { my ($self, $x, $y, $frame) = @_; Term::Caca::_draw_sprite($x, $y, $self, $frame); } sub DESTROY { my ($self) = @_; Term::Caca::_free_sprite($self); } 1; __END__
# $Id$