sub DESTROY {
my $self = shift;
- SDL::FreeSurface($self->{-surface});
- SDL::TTFCloseFont($self->{-font});
+ SDL::FreeSurface($self->{-surface}) if (defined ($self->{-surface}));
+ SDL::TTFCloseFont($self->{-font}) if (defined ($self->{-font}));
}
sub print {
SDL::FreeSurface($self->{-surface}) if ($$self{-surface});
$$self{-surface} = SDL::TTFPutString($$self{-font},$$self{-mode},
- $$surface,$x,$y,${$$self{-fg}},${$$self{-bg}},join("",@text));
+ $$surface,$x,$y,$self->{-fg},$self->{-bg},join("",@text));
croak "Could not print \"", join("",@text), "\" to surface, ",
SDL::GetError(), "\n" unless ($$self{-surface});
if ( SDL::TTFInit() < 0);
1;
-
-__END__;
-
-=pod
-
-=head1 NAME
-
-SDL::TTFont - a SDL perl extension
-
-=head1 SYNOPSIS
-
- $font = new TTFont -name => "Utopia.ttf", -size => 18;
-
-=head1 DESCRIPTION
-
-L<SDL::TTFont> is a module for applying true type fonts to L<SDL::Surface>.
-
-=head1 AUTHOR
-
-David J. Goehrig
-
-=head1 SEE ALSO
-
-L<perl> L<SDL::Surface>
-
-=cut