</div>
<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="DESCRIPTION_CONTENT">
-<p>All <code>color</code> values for the <code>_color</code> functions are <code>0xRRGGBBAA</code> (32bit), even if the surface uses e. g. 8bit colors.</p>
+<p>All functions take an SDL::Surface object as first parameter. This can be a new surface that will be blittet afterwads, can be an surface
+obtained by <a href="/SDL-Video.html#set_video_mode">SDL::Video::set_video_mode</a> or can be an <a href="SDL-App.html">SDL::App</a>.</p>
+<p>The <code>color</code> values for the <code>_color</code> functions are <code>0xRRGGBBAA</code> (32bit), even if the surface uses e. g. 8bit colors.</p>
</div>
<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
use SDL::Surface;
use SDL::GFX::Primitives;
- my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE);
+ my $surface = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE);
- SDL::GFX::Primitives::pixel_color($display, 2, 2, 0xFF0000FF); # red pixcel
- SDL::GFX::Primitives::pixel_RGBA( $display, 4, 4, 0x00, 0xFF, 0x00, 0xFF); # green pixel
+ SDL::GFX::Primitives::pixel_color($surface, 2, 2, 0xFF0000FF); # red pixcel
+ SDL::GFX::Primitives::pixel_RGBA( $surface, 4, 4, 0x00, 0xFF, 0x00, 0xFF); # green pixel
</pre>
<ul><li><a href="#NAME">NAME</a></li>
<li><a href="#CATEGORY">CATEGORY</a></li>
+<li><a href="#CONSTANTS">CONSTANTS</a></li>
<li><a href="#METHODS">METHODS</a>
<ul><li><a href="#General_methods">General methods</a>
<ul><li><a href="#linked_version">linked_version</a></li>
<p>TTF</p>
</div>
+<h1 id="CONSTANTS">CONSTANTS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="CONSTANTS_CONTENT">
+<p>The constants are not exported by default. You can export them into your namespace by doing:</p>
+<pre> use SDL::TTF qw(:hinting :style);
+
+</pre>
+<p>or access them directly:</p>
+<pre> SDL::TTF::TTF_HINTING_NORMAL;
+
+</pre>
+<p>Available constants for "hinting":</p>
+<ul>
+ <li>TTF_HINTING_NORMAL </li>
+ <li>TTF_HINTING_LIGHT </li>
+ <li>TTF_HINTING_MONO </li>
+ <li>TTF_HINTING_NONE</li>
+</ul>
+
+<p>Available constants for "style":</p>
+<ul>
+ <li>TTF_STYLE_NORMAL </li>
+ <li>TTF_STYLE_BOLD </li>
+ <li>TTF_STYLE_ITALIC </li>
+ <li>TTF_STYLE_UNDERLINE </li>
+ <li>TTF_STYLE_STRIKETHROUGH</li>
+</ul>
+
+
+</div>
<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="METHODS_CONTENT">
<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::Video;
- use SDL::Color;
- use SDL::TTF;
- use SDL::TTF::Font;
-
- SDL::init(SDL_INIT_VIDEO);
-
- my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE);
- my $font = SDL::TTF::open_font('arial.ttf', '24);
- 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>