</div>
<h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="SYNOPSIS_CONTENT">
-<pre> use SDL ':init';
- use SDL::Video ':all';
+<pre> use SDL;
+ use SDL::Video;
use SDL::Surface;
use SDL::Rect;
<pre> my @modes = @{ SDL::Video::list_modes( $pixel_format, $flags ) };
</pre>
-<p>Returns a ref to an array of available screen dimensions for the given format and video flags,
-or it return undef if no modes are available.</p>
+<p>Returns a reference to an array:</p>
+<dl>
+ <dt>*
+of available screen dimensions (as <code>SDL::Rect</code>'s) for the given format and video flags. </dt>
+ <dt>*
+with first array element 'all'. In this case you can set all modes.</dt>
+ <dt>*
+with first array element 'none' if no mode is available.</dt>
+</dl>
+<p><strong>Note</strong>: <list_modes> should be called before the video_mode ist set. Otherwise you will always get 'all'.</p>
<p>Example:</p>
<pre> use SDL;
use SDL::Video;
if($#modes > 0)
{
print("available modes:\n");
- foreach my $index ( @modes )
+ foreach my $mode ( @modes )
{
- printf("%03d: %d x %d\n", $index, $modes[$index]->w, $modes[$index]->h );
+ printf("%d x %d\n", $mode->w, $mode->h );
}
}
elsif($#modes == 0)