Commit | Line | Data |
8fde61e3 |
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; |
084b921f |
10 | use warnings; |
11 | use Carp; |
8fde61e3 |
12 | use SDL; |
13 | use SDL::SFont; |
14 | use SDL::Surface; |
15 | |
16 | use vars qw(@ISA $CurrentFont ); |
17 | |
18 | |
19 | @ISA = qw(SDL::Surface); |
20 | |
21 | |
22 | sub new { |
23 | my $proto = shift; |
24 | my $class = ref($proto) || $proto; |
25 | my $self = \SDL::SFont::NewFont(shift); |
26 | bless $self,$class; |
27 | return $self; |
28 | } |
29 | |
30 | sub DESTROY { |
31 | my $self = shift; |
32 | SDL::FreeSurface($$self); |
33 | } |
34 | |
35 | sub use ($) { |
36 | my $self = shift; |
37 | $CurrentFont = $self; |
38 | if ( $self->isa('SDL::Font')) { |
39 | SDL::SFont::UseFont($$self); |
40 | } |
41 | } |
42 | |
43 | 1; |
44 | |
45 | __END__; |
46 | |
47 | =pod |
48 | |
49 | |
50 | =head1 NAME |
51 | |
52 | SDL::Font - a SDL perl extension |
53 | |
54 | =head1 SYNOPSIS |
55 | |
56 | $font = new Font "Font.png"; |
57 | $font->use(); |
58 | |
59 | =head1 DESCRIPTION |
60 | |
61 | L<SDL::Font> provides an interface to loading and using SFont style |
62 | fonts with L<SDL::Surface> objects. |
63 | |
64 | =head1 AUTHOR |
65 | |
66 | David J. Goehrig |
67 | |
68 | =head1 SEE ALSO |
69 | |
70 | L<perl> L<SDL::Surface> |
71 | |
72 | =cut |