<p>The constants are exported by default. You can avoid this by doing:</p>
<pre> use SDL::TTF ();
-
-
-
</pre>
<p>and access them directly:</p>
<pre> SDL::TTF::TTF_HINTING_NORMAL;
<p><strong>Note</strong>: <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=374062">See space-character bug</a>. You have to upgrade libfreetype2 to at least
version 2.3.5</p>
<p>Example:</p>
-<pre> use SDL;
- use SDL::Rect;
- use SDL::Video;
- use SDL::Color;
- use SDL::TTF;
- use SDL::TTF::Font;
-
- SDL::init(SDL_INIT_VIDEO);
- SDL::TTF::init();
- my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE);
- my $font = SDL::TTF::open_font('test/data/aircut3.ttf', '24');
- die 'Coudnt make font '. SDL::get_error if !$font;
- my $surface = SDL::TTF::render_text_solid($font, 'Hallo!', SDL::Color->new(0xFF,0xFF,0xFF));
- SDL::Video::blit_surface($surface, SDL::Rect->new(0, 0, 640, 480), $display, SDL::Rect->new(10, 10, 640, 480));
- SDL::Video::update_rect($display, 0, 0, 0, 0);
- SDL::delay(5000);
+<pre> use SDL;
+ use SDL::Rect;
+ use SDL::Video;
+ use SDL::Color;
+ use SDL::TTF;
+ use SDL::TTF::Font;
+
+ SDL::init(SDL_INIT_VIDEO);
+ SDL::TTF::init();
+ my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE);
+ my $font = SDL::TTF::open_font('test/data/aircut3.ttf', '24');
+ die 'Coudnt make font '. SDL::get_error if !$font;
+ my $surface = SDL::TTF::render_text_solid($font, 'Hallo!', SDL::Color->new(0xFF,0xFF,0xFF));
+ SDL::Video::blit_surface($surface, SDL::Rect->new(0, 0, 640, 480), $display, SDL::Rect->new(10, 10, 640, 480));
+ SDL::Video::update_rect($display, 0, 0, 0, 0);
+ SDL::delay(5000);
</pre>