First commit of SDL_Perl-2.1.3
[sdlgit/SDL_perl.git] / lib / SDL / Font.pm
1 #       Font.pm
2 #
3 #       a SDL perl extension for SFont support
4 #
5 #       Copyright (C) David J. Goehrig 2000,2002
6 #
7
8 package SDL::Font;
9 use strict;
10 use SDL;
11 use SDL::SFont;
12 use SDL::Surface;
13
14 use vars qw(@ISA $CurrentFont );
15             
16
17 @ISA = qw(SDL::Surface);
18
19
20 sub new {
21         my $proto = shift;
22         my $class = ref($proto) || $proto;
23         my $self = \SDL::SFont::NewFont(shift);
24         bless $self,$class;
25         return $self;   
26 }
27
28 sub DESTROY {
29         my $self = shift;
30         SDL::FreeSurface($$self);
31 }
32
33 sub use ($) {
34         my $self = shift;
35         $CurrentFont = $self;
36         if ( $self->isa('SDL::Font')) {
37                 SDL::SFont::UseFont($$self);
38         }       
39 }
40
41 1;
42
43 __END__;
44
45 =pod
46
47
48 =head1 NAME
49
50 SDL::Font - a SDL perl extension
51
52 =head1 SYNOPSIS
53
54   $font = new Font "Font.png";
55   $font->use();
56         
57 =head1 DESCRIPTION
58
59 L<SDL::Font> provides an interface to loading and using SFont style 
60 fonts with L<SDL::Surface> objects.  
61
62 =head1 AUTHOR
63
64 David J. Goehrig
65
66 =head1 SEE ALSO
67
68 L<perl> L<SDL::Surface>
69
70 =cut