Moved Video to SMPGEG. Maybe move this to SDL::Game::Video later
[sdlgit/SDL_perl.git] / lib / SDL / Font.pm
CommitLineData
7b6a53a1 1#!/usr/bin/env perl
8fde61e3 2#
7b6a53a1 3# Font.pm
8fde61e3 4#
7b6a53a1 5# Copyright (C) 2005 David J. Goehrig <dgoehrig@cpan.org>
6#
7# ------------------------------------------------------------------------------
8#
9# This library is free software; you can redistribute it and/or
10# modify it under the terms of the GNU Lesser General Public
11# License as published by the Free Software Foundation; either
12# version 2.1 of the License, or (at your option) any later version.
13#
14# This library is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17# Lesser General Public License for more details.
18#
19# You should have received a copy of the GNU Lesser General Public
20# License along with this library; if not, write to the Free Software
21# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22#
23# ------------------------------------------------------------------------------
24#
25# Please feel free to send questions, suggestions or improvements to:
26#
27# David J. Goehrig
28# dgoehrig@cpan.org
8fde61e3 29#
30
31package SDL::Font;
7b6a53a1 32
8fde61e3 33use strict;
084b921f 34use warnings;
35use Carp;
8fde61e3 36use SDL;
37use SDL::SFont;
38use SDL::Surface;
39
40use vars qw(@ISA $CurrentFont );
41
42
43@ISA = qw(SDL::Surface);
44
45
46sub new {
47 my $proto = shift;
48 my $class = ref($proto) || $proto;
49 my $self = \SDL::SFont::NewFont(shift);
50 bless $self,$class;
51 return $self;
52}
53
54sub DESTROY {
55 my $self = shift;
56 SDL::FreeSurface($$self);
57}
58
59sub use ($) {
60 my $self = shift;
61 $CurrentFont = $self;
62 if ( $self->isa('SDL::Font')) {
63 SDL::SFont::UseFont($$self);
64 }
65}
66
671;
68
69__END__;
70
71=pod
72
73
74=head1 NAME
75
76SDL::Font - a SDL perl extension
77
78=head1 SYNOPSIS
79
80 $font = new Font "Font.png";
81 $font->use();
82
83=head1 DESCRIPTION
84
85L<SDL::Font> provides an interface to loading and using SFont style
86fonts with L<SDL::Surface> objects.
87
88=head1 AUTHOR
89
90David J. Goehrig
91
92=head1 SEE ALSO
93
94L<perl> L<SDL::Surface>
95
96=cut